forked from sigmavirus24/github3.py
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstatus.py
More file actions
39 lines (32 loc) · 1.38 KB
/
status.py
File metadata and controls
39 lines (32 loc) · 1.38 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
# -*- coding: utf-8 -*-
"""
github3.repos.status
====================
This module contains the Status object for GitHub's commit status API
"""
from __future__ import unicode_literals
from ..models import GitHubObject
from ..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 = self._strptime(status.get('updated_at'))
def _repr(self):
return '<Status [{s.id}:{s.state}]>'.format(s=self)