/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to breezy/plugins/propose/github.py

  • Committer: Breezy landing bot
  • Author(s): Jelmer Vernooij
  • Date: 2019-12-26 14:21:25 UTC
  • mfrom: (7428.1.2 github-perm-denied)
  • Revision ID: breezy.the.bot@gmail.com-20191226142125-cd1y1kyo29ezz2y2
github: Handle 403s for pull request creation.

Merged from https://code.launchpad.net/~jelmer/brz/github-perm-denied/+merge/377117

Show diffs side-by-side

added added

removed removed

Lines of Context:
43
43
    version_string as breezy_version,
44
44
    )
45
45
from ...config import AuthenticationConfig, GlobalStack
46
 
from ...errors import InvalidHttpResponse
 
46
from ...errors import InvalidHttpResponse, PermissionDenied
47
47
from ...git.urls import git_url_to_bzr_url
48
48
from ...i18n import gettext
49
49
from ...sixish import PY3
278
278
 
279
279
        response = self._api_request(
280
280
            'POST', path, body=json.dumps(data).encode('utf-8'))
 
281
        if response.status == 403:
 
282
            raise PermissionDenied(path, response.text)
281
283
        if response.status != 201:
282
284
            raise InvalidHttpResponse(path, 'req is invalid %d %r: %r' % (response.status, data, response.text))
283
285
        return json.loads(response.text)