Skip to content

Fix attrs update for missing ones #992

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 12, 2020

Conversation

simahawk
Copy link
Contributor

calling self.github.me() causes:

python3.6/site-packages/github3/users.py", line 888, in _update_attributes
    self.disk_usage = user["disk_usage"]
KeyError: 'disk_usage'

Older versions were tolerant regarding this.

@omgjlk omgjlk linked an issue Aug 12, 2020 that may be closed by this pull request
@omgjlk omgjlk merged commit 16da0bf into sigmavirus24:master Aug 12, 2020
@mpereira
Copy link

Just for the record, if anyone else ends up here after a Google search.

I'm seeing this issue with github3.py version 1.3.0 via the community.general version 1.3.5 Ansible module (which calls the me() method for some reason):

An exception occurred during task execution. To see the full traceback, use -vvv. The error was: github3.exceptions.IncompleteResponse: None The library was expecting more data in the response (KeyError('disk_usage')). Either GitHub modified it's response body, or your token is not properly scoped to retrieve this information.
fatal: [198.211.112.217]: FAILED! => changed=false 
  module_stderr: |-
    Shared connection to <...> closed.
  module_stdout: |-
    Traceback (most recent call last):
      File "/usr/local/lib/python3.8/dist-packages/github3/models.py", line 48, in __init__
        self._update_attributes(json)
      File "/usr/local/lib/python3.8/dist-packages/github3/users.py", line 888, in _update_attributes
        self.disk_usage = user["disk_usage"]
    KeyError: 'disk_usage'
  
    During handling of the above exception, another exception occurred:
  
    Traceback (most recent call last):
      File "/root/.ansible/tmp/ansible-tmp-1613218488.201194-96702-233399213928122/AnsiballZ_github_release.py", line 102, in <module>
        _ansiballz_main()
      File "/root/.ansible/tmp/ansible-tmp-1613218488.201194-96702-233399213928122/AnsiballZ_github_release.py", line 94, in _ansiballz_main
        invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)
      File "/root/.ansible/tmp/ansible-tmp-1613218488.201194-96702-233399213928122/AnsiballZ_github_release.py", line 40, in invoke_module
        runpy.run_module(mod_name='ansible_collections.community.general.plugins.modules.github_release', init_globals=None, run_name='__main__', alter_sys=True)
      File "/usr/lib/python3.8/runpy.py", line 207, in run_module
        return _run_module_code(code, init_globals, run_name, mod_spec)
      File "/usr/lib/python3.8/runpy.py", line 97, in _run_module_code
        _run_code(code, mod_globals, init_globals,
      File "/usr/lib/python3.8/runpy.py", line 87, in _run_code
        exec(code, run_globals)
      File "/tmp/ansible_community.general.github_release_payload_3bw4z4yd/ansible_community.general.github_release_payload.zip/ansible_collections/community/general/plugins/modules/github_release.py", line 213, in <module>
      File "/tmp/ansible_community.general.github_release_payload_3bw4z4yd/ansible_community.general.github_release_payload.zip/ansible_collections/community/general/plugins/modules/github_release.py", line 181, in main
      File "/usr/local/lib/python3.8/dist-packages/github3/decorators.py", line 31, in auth_wrapper
        return func(self, *args, **kwargs)
      File "/usr/local/lib/python3.8/dist-packages/github3/github.py", line 1469, in me
        return self._instance_or_null(users.AuthenticatedUser, json)
      File "/usr/local/lib/python3.8/dist-packages/github3/models.py", line 146, in _instance_or_null
        return instance_class(json, self)
      File "/usr/local/lib/python3.8/dist-packages/github3/models.py", line 50, in __init__
        raise exceptions.IncompleteResponse(json, kerr)
    github3.exceptions.IncompleteResponse: None The library was expecting more data in the response (KeyError('disk_usage')). Either GitHub modified it's response body, or your token is not properly scoped to retrieve this information.
  msg: |-
    MODULE FAILURE
    See stdout/stderr for the exact error
  rc: 1
$ python3.8 -m pip list | grep github3.py
github3.py             1.3.0

The issue is fixed by giving the token read:user permissions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Error when authenticated through OAuth without the user scope
3 participants