Skip to content

Commit e71a66d

Browse files
committed
Handle status contexts
Related: sigmavirus24#256
1 parent 61c9a3c commit e71a66d

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

github3/repos/deployment.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@ def _update_attributes(self, deployment):
4949
def _repr(self):
5050
return '<Deployment [{0} @ {1}]>'.format(self.id, self.sha)
5151

52-
def create_status(self, state, target_url='', description=''):
52+
def create_status(self, state, target_url=None, description=None,
53+
context=None):
5354
"""Create a new deployment status for this deployment.
5455
5556
:param str state: (required), The state of the status. Can be one of
@@ -65,7 +66,8 @@ def create_status(self, state, target_url='', description=''):
6566

6667
if state in ('pending', 'success', 'error', 'failure'):
6768
data = {'state': state, 'target_url': target_url,
68-
'description': description}
69+
'description': description, 'context': context}
70+
self._remove_none(data)
6971
response = self._post(self.statuses_url, data=data,
7072
headers=Deployment.CUSTOM_HEADERS)
7173
json = self._json(response, 201)

github3/repos/status.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ class Status(GitHubObject):
1919
See also: http://developer.github.com/v3/repos/statuses/
2020
"""
2121
def _update_attributes(self, status):
22+
#: A string label to differentiate this status from the status of
23+
#: other systems
24+
self.context = status.get('context')
2225
#: datetime object representing the creation of the status object
2326
self.created_at = self._strptime(status.get('created_at'))
2427
#: :class:`User <github3.users.User>` who created the object

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy