8000 Make a few changes I forgot I needed to make. · jsullivanlive/github3.py@a2ee875 · GitHub
[go: up one dir, main page]

Skip to content

Commit a2ee875

Browse files
committed
Make a few changes I forgot I needed to make.
1 parent 58a2278 commit a2ee875

File tree

4 files changed

+9
-6
lines changed

4 files changed

+9
-6
lines changed

github3/event.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class Event(GitHubCore):
1515
section of the GitHub API.
1616
"""
1717
def __init__(self, event, session=None):
18-
super(Event, self).__init__(session)
18+
super(Event, self).__init__(event, session)
1919
from .user import User
2020
from .org import Organization
2121
self._created = self._strptime(event.get('created_at'))

github3/gist.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,14 +75,14 @@ class Gist(GitHubCore):
7575
"""
7676

7777
def __init__(self, data, session=None):
78-
super(Gist, self).__init__(session)
79-
78+
super(Gist, self).__init__(data, session)
8079
self._update_(data)
8180

8281
def __repr__(self):
8382
return '<Gist [%s]>' % self._id
8483

8584
def _update_(self, data):
85+
self._json_data = data
8686
# The gist identifier
8787
self._id = data.get('id')
8888
self._desc = data.get('description')
@@ -112,6 +112,7 @@ def _update_(self, data):
112112
for file in data['files']:
113113
self._files.append(GistFile(data['files'][file]))
114114

115+
@GitHubCore.requires_auth
115116
def create_comment(self, body):
116117
"""Create a comment on this gist.
117118

github3/git.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ class GitData(GitHubCore):
4848
common items among other Git Data objects.
4949
"""
5050
def __init__(self, data, session=None):
51-
super(GitData, self).__init__(session)
51+
super(GitData, self).__init__(data, session)
5252
self._sha = data.get('sha')
5353
self._api = data.get('url')
5454

github3/github.py

Lines changed: 4 ad 8000 ditions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
class GitHub(GitHubCore):
2222
"""Stores all the session information."""
23-
def __init__(self):
23+
def __init__(self, login='', password=''):
2424
super(GitHub, self).__init__({})
2525
# Only accept JSON responses
2626
self._session.headers.update(
@@ -30,6 +30,8 @@ def __init__(self):
3030
# Identify who we are
3131
self._session.config['base_headers'].update(
3232
{'User-Agent': 'github3.py/pre-alpha'})
33+
if login and password:
34+
self.login(login, password)
3335

3436
def __repr__(self):
3537
return '<GitHub at 0x%x>' % id(self)
@@ -723,7 +725,7 @@ def unwatch(self, login, repo):
723725
class Authorization(GitHubCore):
724726
"""The :class:`Authorization <Authorization>` object."""
725727
def __init__(self, auth, session):
726-
super(Authorization, self).__init__(session)
728+
super(Authorization, self).__init__(auth, session)
727729
self._update_(auth)
728730

729731
def __repr__(self):

0 commit comments

Comments
 (0)
0