forked from sigmavirus24/github3.py
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathstatus.py
More file actions
40 lines (33 loc) · 1.43 KB
/
Copy pathstatus.py
File metadata and controls
40 lines (33 loc) · 1.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# -*- coding: utf-8 -*-
"""
github3.repos.status
====================
This module contains the Status object for GitHub's commit status API
"""
from github3.models import GitHubObject
from github3.users import User
class Status(GitHubObject):
"""The :class:`Status <Status>` object. This represents information from
the Repo Status API.
See also: http://developer.github.com/v3/repos/statuses/
"""
def __init__(self, status):
super(Status, self).__init__(status)
#: datetime object representing the creation of the status object
self.created_at = self._strptime(status.get('created_at'))
#: :class:`User <github3.users.User>` who created the object
self.creator = User(status.get('creator'))
#: Short description of the Status
self.description = status.get('description')
#: GitHub ID for the status object
self.id = status.get('id')
#: State of the status, e.g., 'success', 'pending', 'failed', 'error'
self.state = status.get('state')
#: URL to view more information about the status
self.target_url = status.get('target_url')
#: datetime object representing the last time the status was updated
self.updated_at = None
if status.get('updated_at'):
self.updated_at = self._strptime(status.get('updated_at'))
def __repr__(self):
return '<Status [{s.id}:{s.state}]>'.format(s=self)