I am trying to create a list of complete set of dependencies (recursive traversal of dependencies) for a given Jenkins plugin. I have tried this below code snippet.

```
from requests import Session

session = Session()

deps = []

def get_deps():
    user_input = input('Enter a jenkins plug-in name: ')
    print(user_input)
    url = "https://plugins.jenkins.io/api/plugin/"+user_input+""
    reqs = session.get(url)
    response = reqs.json()
    for item in response['dependencies']:
        print(item['name'])
        deps.append(item['name'])
    print(deps)

    for elem in deps:
        url = "https://plugins.jenkins.io/api/plugin/"+elem+""
        reqs = session.get(url)
        response = reqs.json()
        for item in response['dependencies']:
            deps.append(item['name'])
        print(deps)

get_deps()

```

This will create an infinite loop. How to ensure that a list element which has been visited before is not acted upon once again?