示例#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)
示例#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)
示例#3
0
文件: driver.py 项目: mbad0la/octopy
 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!"
示例#4
0
文件: notifs.py 项目: mbad0la/octopy
 def get_notifs(self):
     return build_call("get", "notifications", self.requester,
                       self.authstring, {}, self.istoken)
示例#5
0
文件: notifs.py 项目: mbad0la/octopy
 def repo_notif(self, owner, name):
     return build_call("get",
                       "repos/" + owner + "/" + name + "/notifications",
                       self.requester, self.authstring, {}, self.istoken)
示例#6
0
文件: driver.py 项目: mbad0la/octopy
 def __init__(self, username, authstring, token = False):
     self.authstring = authstring
     self.istoken = token
     self.authbearer = build_call("get", "user", username, authstring, {}, token)
示例#7
0
 def my_followers(self):
     return build_call("get", "user/followers", self.requester,
                       self.authstring, {}, self.istoken)
示例#8
0
 def get_following(self, username):
     return build_call("get", "users/" + username + "/following",
                       self.requester, self.authstring, {}, self.istoken)
示例#9
0
 def get_stargazers(self, owner, name):
     return build_call("get", "repos/" + owner + "/" + name + "/stargazers",
                       self.requester, self.authstring, {}, self.istoken)
示例#10
0
 def unstar_it(self, owner, name):
     return build_call("delete", "user/starred/" + owner + "/" + name,
                       self.requester, self.authstring, {}, self.istoken)