Exemple #1
0
 def get_feed(self, entity, isorg):
     if not isorg:
         return build_call("get", "users/" + entity + "/received_events",
                           self.requester, self.authstring, {},
                           self.istoken)
     else:
         return build_call("get", "orgs/" + entity + "/events",
                           self.requester, self.authstring, {},
                           self.istoken)
Exemple #2
0
 def new_trending(self, days):
     st = datetime.datetime.fromtimestamp(
         time.time()) - datetime.timedelta(days=days)
     st = st.strftime('%Y-%m-%dT%H:%M:%S')
     params = {
         'q': 'created:>' + st,
         'sort': 'stars',
         'order': 'desc',
         'per_page': 25
     }
     return build_call("get", "search/repositories", self.requester,
                       self.authstring, params, self.istoken)
Exemple #3
0
 def get_token(self, clientid, clientsecret, scopes = []):
     options = { 'note': "get-me-token", 'client_id': clientid,'client_secret': clientsecret,'fingerprint': self.authbearer["login"], 'scopes': scopes}
     if self.istoken:
         return self.authstring
     else:
         r = build_call("post", "authorizations", self.authbearer["login"], self.authstring, options)
         try:
             self.authstring = r['token']
             self.istoken = True
             return self.authstring
         except:
             return "You already have a token corresponding to this app!"
Exemple #4
0
 def get_notifs(self):
     return build_call("get", "notifications", self.requester,
                       self.authstring, {}, self.istoken)
Exemple #5
0
 def repo_notif(self, owner, name):
     return build_call("get",
                       "repos/" + owner + "/" + name + "/notifications",
                       self.requester, self.authstring, {}, self.istoken)
Exemple #6
0
 def __init__(self, username, authstring, token = False):
     self.authstring = authstring
     self.istoken = token
     self.authbearer = build_call("get", "user", username, authstring, {}, token)
Exemple #7
0
 def my_followers(self):
     return build_call("get", "user/followers", self.requester,
                       self.authstring, {}, self.istoken)
Exemple #8
0
 def get_following(self, username):
     return build_call("get", "users/" + username + "/following",
                       self.requester, self.authstring, {}, self.istoken)
Exemple #9
0
 def get_stargazers(self, owner, name):
     return build_call("get", "repos/" + owner + "/" + name + "/stargazers",
                       self.requester, self.authstring, {}, self.istoken)
Exemple #10
0
 def unstar_it(self, owner, name):
     return build_call("delete", "user/starred/" + owner + "/" + name,
                       self.requester, self.authstring, {}, self.istoken)