1

我尝试使用 pygithub 模块,教程代码中出现错误。

发生错误“socket.gaierror: [Errno -2] Name or service not known”,我不知道为什么。

这是我的教程代码:

user = Github("id", "password")

publicRepos = user.get_repos()

for repo in publicRepos:
    print repo.name

我收到以下错误:

          .
          .
          .
          .

File "/usr/lib64/python2.7/httplib.py", line 969, in endheaders
  self._send_output(message_body)
File "/usr/lib64/python2.7/httplib.py", line 829, in _send_output
  self.send(msg)
File "/usr/lib64/python2.7/httplib.py", line 791, in send
  self.connect()
File "/usr/lib64/python2.7/httplib.py", line 1172, in connect
  self.timeout, self.source_address)
File "/usr/lib64/python2.7/socket.py", line 553, in create_connection
  for res in getaddrinfo(host, port, 0, SOCK_STREAM):
socket.gaierror: [Errno -2] Name or service not know

请告诉我如何解决。

4

0 回答 0