GothenburgBitFactory / bugwarrior

Pull github, bitbucket, and trac issues into taskwarrior
http://pypi.python.org/pypi/bugwarrior
GNU General Public License v3.0
732 stars 209 forks source link

Weird github API error #927

Closed folofjc closed 2 years ago

folofjc commented 2 years ago

I saw this on #925 here

INFO:bugwarrior.services:Working on [github]
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): api.github.com:443
DEBUG:urllib3.connectionpool:https://api.github.com:443 "GET /search/issues?q=author:folofjc%20is:open&per_page=100 HTTP/1.1" 200 None
DEBUG:urllib3.connectionpool:https://api.github.com:443 "GET /user/repos?per_page=100 HTTP/1.1" 200 None
DEBUG:urllib3.connectionpool:https://api.github.com:443 "GET /users//repos?per_page=100 HTTP/1.1" 404 None
WARNING:bugwarrior.services.github:A '404' from github may indicate an auth failure. Make sure both that your token is correct and that it has 'public_repo' and not 'public access' rights.
ERROR:bugwarrior.services:Worker for [github] failed: Non-200 status code 404; 'https://api.github.com/users//repos?per_page=100'; '{"message":"Not Found","documentation_url":"https://docs.github.com/rest"}'                                                                                             Traceback (most recent call last):
   File "/home/pgesting/.pyenv/versions/3.10.4/lib/python3.10/site-packages/bugwarrior-1.8.0-py3.10.egg/bugwarrior/services/__init__.py", line 444, in _aggregate_issues
      for issue in service.issues():
   File "/home/pgesting/.pyenv/versions/3.10.4/lib/python3.10/site-packages/bugwarrior-1.8.0-py3.10.egg/bugwarrior/services/github.py", line 450, in issues
      all_repos = self.client.get_repos(self.config.username)
   File "/home/pgesting/.pyenv/versions/3.10.4/lib/python3.10/site-packages/bugwarrior-1.8.0-py3.10.egg/bugwarrior/services/github.py", line 77, in get_repos
      public_repos = self._getter(self._api_url(
   File "/home/pgesting/.pyenv/versions/3.10.4/lib/python3.10/site-packages/bugwarrior-1.8.0-py3.10.egg/bugwarrior/services/github.py", line 136, in _getter
      json_res = self.json_response(response)
   File "/home/pgesting/.pyenv/versions/3.10.4/lib/python3.10/site-packages/bugwarrior-1.8.0-py3.10.egg/bugwarrior/services/__init__.py", line 420, in json_response
      raise OSError(
OSError: Non-200 status code 404; 'https://api.github.com/users//repos?per_page=100'; '{"message":"Not Found","documentation_url":"https://docs.github.com/rest"}'
INFO:bugwarrior.services:Done with [github] in 1.366617s
ERROR:bugwarrior.services:Aborted github due to critical error.  

It looks like there is an extra slash in the call https://api.github.com/users//repos?per_page=100 which should instead be https://api.github.com/users/repos?per_page=100

Here is my service for github:

[github]
service = github
github.login = folofjc
github.token = ###
github.import_labels_as_tags = False
github.query = author:folofjc is:open

EDIT: If I put in a username and repo to search, I do not get this error, so maybe it is just an error when only a query is given?

ryneeverett commented 2 years ago

The problem is you either need to set github.username or set github.include_user_repos = false. See #929.

folofjc commented 2 years ago

Ah, that makes sense. Thanks!