Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

adding support for requests==0.10.2 and removing pdb

  • Loading branch information...
commit f561d79de4d85d23bf1710ff654380deb815a51c 1 parent 30d3131
Rok Garbas authored
7  githubcollective/config.py
@@ -34,7 +34,7 @@ def __init__(self, filename, verbose, pretend):
34 34
              self.is_url(filename):
35 35
             response = requests.get(filename)
36 36
             response.raise_for_status()
37  
-            data = response.read()
  37
+            data = response.text
38 38
         elif type(filename) in [str, unicode] and \
39 39
              os.path.exists(filename):
40 40
             f = open(filename)
@@ -48,10 +48,7 @@ def __init__(self, filename, verbose, pretend):
48 48
 
49 49
     def parse(self, data):
50 50
         teams, repos = {}, {}
51  
-        try:
52  
-            data = json.loads(data)
53  
-        except:
54  
-            import ipdb; ipdb.set_trace()
  51
+        data = json.loads(data)
55 52
 
56 53
         for team in data['teams']:
57 54
             team = Team(**team)
19  githubcollective/github.py
@@ -33,7 +33,7 @@ def __init__(self, organization, username, password, verbose, pretend):
33 33
     # requests library helpers
34 34
 
35 35
     def _request(self, method, url, data=None):
36  
-        kw = {'url': BASE_URL+url+'?per_page=10000',
  36
+        kw = {'url': BASE_URL + url + '?per_page=10000',
37 37
               'headers': self.headers}
38 38
         if data:
39 39
             kw['data'] = data
@@ -49,14 +49,11 @@ def _request(self, method, url, data=None):
49 49
                 method.__name__.upper(),
50 50
                 kw['url'],
51 51
                 )
52  
-        try:
53  
-            response.raise_for_status()
54  
-        except:
55  
-            import ipdb; ipdb.set_trace()
  52
+        response.raise_for_status()
56 53
         return response
57 54
 
58 55
     def _get_request(self, url):
59  
-        return json.load(self._request(requests.get, url))
  56
+        return json.loads(self._request(requests.get, url).text)
60 57
 
61 58
     def _delete_request(self, url):
62 59
         if self.pretend:
@@ -97,7 +94,8 @@ def _gh_org_repos(self):
97 94
         return self._get_request('/orgs/%s/repos' % self.org)
98 95
 
99 96
     def _gh_org_fork_repo(self, fork_url):
100  
-        return self._post_request('/repos/%s/forks' % fork_url, {'org': self.org})
  97
+        return self._post_request('/repos/%s/forks' % fork_url,
  98
+                {'org': self.org})
101 99
 
102 100
     def _gh_org_create_repo(self, name):
103 101
         return self._post_request('/orgs/%s/repos' % self.org, json.dumps({
@@ -128,8 +126,9 @@ def _gh_org_remove_team_member(self, id, member):
128 126
         return self._delete_request('/teams/%s/members/%s' % (id, member))
129 127
 
130 128
     def _gh_org_add_team_repo(self, id, repo):
131  
-        return self._put_request('/teams/%s/repos/%s/%s' % (id, self.org, repo))
  129
+        return self._put_request('/teams/%s/repos/%s/%s' %
  130
+                (id, self.org, repo))
132 131
 
133 132
     def _gh_org_remove_team_repo(self, id, repo):
134  
-        return self._delete_request('/teams/%s/repos/%s/%s' % (id, self.org, repo))
135  
-
  133
+        return self._delete_request('/teams/%s/repos/%s/%s' %
  134
+                (id, self.org, repo))

0 notes on commit f561d79

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