0

The below code I am using to connect git-repo to list all the files available in the mentioned repository path. It fails specifying the error 'socket.gaierror: [Errno 11001] getaddrinfo failed'

Tried accessing using user credentials. But the same error comes up.

def requestGitCallToken(inputpath):
    username = 'user'
    token = 'token'
    repos_url = inputpath + 'smuk29/codered' 
    # create a re-usable session object with the user creds in-built
    gh_session = requests.Session()
    gh_session.auth = (username, token)
    # get the list of repos belonging to me
    repos = json.loads(gh_session.get(repos_url).text)
    print(repos)
    # print the repo names
    for repo in repos:
        print(str(repo['name']))

requestGitCallToken("https://github.com/")
Traceback (most recent call last):
  File "C:\Users\Deep\AppData\Local\Programs\Python\Python37\lib\site-packages\urllib3\connection.py", line 160, in _new_conn
    (self._dns_host, self.port), self.timeout, **extra_kw)
  File "C:\Users\Deep\AppData\Local\Programs\Python\Python37\lib\site-packages\urllib3\util\connection.py", line 57, in create_connection
    for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM):
  File "C:\Users\Deep\AppData\Local\Programs\Python\Python37\lib\socket.py", line 748, in getaddrinfo
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno 11001] getaddrinfo failed
Shubhankar
  • 95
  • 1
  • 14
  • Are you trying to list only top-level files or full tree? Also, are you really going to parse HTML to get the file list? – Marat Sep 04 '19 at 14:30
  • i want to access the git link and list out the contents / repo names available – Shubhankar Sep 04 '19 at 18:50

0 Answers0