github3.py icon indicating copy to clipboard operation
github3.py copied to clipboard

KeyError when updating required_approving_review_count on protected branch

Open martinb3 opened this issue 6 years ago • 0 comments

Version Information

Please provide:

  • The version of Python you're using

Python 2.7.15

  • The version of pip you used to install github3.py

pip 19.2.2

  • The version of github3.py, requests, uritemplate, and dateutil installed

github3.py==1.3.0 python-dateutil==2.7.5 requests==2.20.1 uritemplate==3.0.0 uritemplate.py==3.0.2

Minimum Reproducible Example

gh = github3.login(token='redacted')
org = gh.organization('myorg')
for repo in org.repositories():
  master = repo.branch('master')
  protection = master.protection()
  req_reviews = protection.required_pull_request_reviews
  req_reviews.update(required_approving_review_count=2, dismiss_stale_reviews=False)

Exception information

What is exceptional about what you're seeing versus what you expected to see.

Traceback (most recent call last):
  File "undismiss-stale-reviews.py", line 43, in <module>
    req_reviews.update(required_approving_review_count=2, dismiss_stale_reviews=False)
  File "/Users/martinb3/.pyenv/versions/redacted-2.7.15/lib/python2.7/site-packages/github3/decorators.py", line 31, in auth_wrapper
    return func(self, *args, **kwargs)
  File "/Users/martinb3/.pyenv/versions/redacted-2.7.15/lib/python2.7/site-packages/github3/repos/branch.py", line 789, in update
    self._update_attributes(json)
  File "/Users/martinb3/.pyenv/versions/redacted-2.7.15/lib/python2.7/site-packages/github3/repos/branch.py", line 708, in _update_attributes
    value = protection["required_approving_review_count"]
KeyError: u'required_approving_review_count'

I'm noticing that I can supply values like dismiss_stale_reviews and they'll be updated, despite the keyerror, but I cannot update required_approving_review_count no matter what I try.

martinb3 avatar Aug 14 '19 09:08 martinb3