Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

adding support for requests==0.10.2 and removing pdb

  • Loading branch information...
commit f561d79de4d85d23bf1710ff654380deb815a51c 1 parent 30d3131
@garbas authored
Showing with 11 additions and 15 deletions.
  1. +2 −5 githubcollective/config.py
  2. +9 −10 githubcollective/github.py
View
7 githubcollective/config.py
@@ -34,7 +34,7 @@ def __init__(self, filename, verbose, pretend):
self.is_url(filename):
response = requests.get(filename)
response.raise_for_status()
- data = response.read()
+ data = response.text
elif type(filename) in [str, unicode] and \
os.path.exists(filename):
f = open(filename)
@@ -48,10 +48,7 @@ def __init__(self, filename, verbose, pretend):
def parse(self, data):
teams, repos = {}, {}
- try:
- data = json.loads(data)
- except:
- import ipdb; ipdb.set_trace()
+ data = json.loads(data)
for team in data['teams']:
team = Team(**team)
View
19 githubcollective/github.py
@@ -33,7 +33,7 @@ def __init__(self, organization, username, password, verbose, pretend):
# requests library helpers
def _request(self, method, url, data=None):
- kw = {'url': BASE_URL+url+'?per_page=10000',
+ kw = {'url': BASE_URL + url + '?per_page=10000',
'headers': self.headers}
if data:
kw['data'] = data
@@ -49,14 +49,11 @@ def _request(self, method, url, data=None):
method.__name__.upper(),
kw['url'],
)
- try:
- response.raise_for_status()
- except:
- import ipdb; ipdb.set_trace()
+ response.raise_for_status()
return response
def _get_request(self, url):
- return json.load(self._request(requests.get, url))
+ return json.loads(self._request(requests.get, url).text)
def _delete_request(self, url):
if self.pretend:
@@ -97,7 +94,8 @@ def _gh_org_repos(self):
return self._get_request('/orgs/%s/repos' % self.org)
def _gh_org_fork_repo(self, fork_url):
- return self._post_request('/repos/%s/forks' % fork_url, {'org': self.org})
+ return self._post_request('/repos/%s/forks' % fork_url,
+ {'org': self.org})
def _gh_org_create_repo(self, name):
return self._post_request('/orgs/%s/repos' % self.org, json.dumps({
@@ -128,8 +126,9 @@ def _gh_org_remove_team_member(self, id, member):
return self._delete_request('/teams/%s/members/%s' % (id, member))
def _gh_org_add_team_repo(self, id, repo):
- return self._put_request('/teams/%s/repos/%s/%s' % (id, self.org, repo))
+ return self._put_request('/teams/%s/repos/%s/%s' %
+ (id, self.org, repo))
def _gh_org_remove_team_repo(self, id, repo):
- return self._delete_request('/teams/%s/repos/%s/%s' % (id, self.org, repo))
-
+ return self._delete_request('/teams/%s/repos/%s/%s' %
+ (id, self.org, repo))

0 comments on commit f561d79

Please sign in to comment.
Something went wrong with that request. Please try again.