Exemplo n.º 1
0
 def do_login(self, _):
     u = self.userBox.GetValue()
     p = self.passBox.GetValue()
     g = Github(u, p)
     status, data = g.issues.get()
     if status != 200:
         self.error.SetLabel('ERROR: ' + data['message'])
     elif callable(self.callback):
         self.callback(u, p)
Exemplo n.º 2
0
 def do_search(self, event):
     term = self.searchTerm.GetValue()
     org = self.orgChoice.GetString(self.orgChoice.GetCurrentSelection())
     g = Github(self.credentials['username'], self.credentials['password'])
     code, data = g.search.issues.get(q="user:{} {}".format(org, term))
     if code != 200:
         self.display_error(code, data)
     else:
         self.display_results(data['items'])
Exemplo n.º 3
0
 def test_credentials(self):
     if any(k not in self.credentials for k in ['username', 'password']):
         return False
     g = Github(self.credentials['username'], self.credentials['password'])
     status, data = g.user.orgs.get()
     if status != 200:
         print('bad credentials in store')
         return False
     self.orgs = [o['login'] for o in data]
     return True
Exemplo n.º 4
0
    def get_github_uploader():
        from agithub import Github
        import requests

        with open(os.path.expanduser("~/.frida-release-github-token"),
                  "r") as f:
            token = f.read().strip()

        g = Github(token=token)

        def repo():
            return g.repos.frida.frida

        status, data = repo().releases.tags[tag_name].get()
        if status != 200:
            if status == 404:
                status, data = repo().releases.post(
                    body={
                        'tag_name': tag_name,
                        'name': "Frida {}".format(version),
                        'body': "See http://www.frida.re/news/ for details.",
                    })
            else:
                raise RuntimeError(
                    "Unexpected error trying to get current release; status={} data={}"
                    .format(status, data))

        upload_url = data['upload_url']
        upload_url = upload_url[:upload_url.index("{")]

        def upload(name, mimetype, data):
            try:
                r = requests.post(url=upload_url,
                                  params={
                                      "name": name,
                                  },
                                  headers={
                                      "Authorization":
                                      "Token {}".format(token),
                                      "Content-Type": mimetype,
                                  },
                                  data=data)
                r.raise_for_status()
                print("Uploaded", name)
            except Exception as e:
                print("Skipping {}: {}".format(name, e))

        return upload
Exemplo n.º 5
0
#Demo script showing basic functionality of [agithub](https://github.com/jpaugh/agithub) Python module
#Toni @SparkFun Electronics 2015
#Please review the LICENSE.md file for license information

import json
from agithub import Github

g = Github(token='<Access Token>')
OrgInfo = g.orgs.<Organziation Name>.get()

with open('Organization.json', 'w') as outfile:
	json.dump([OrgInfo], outfile, separators=(',',':'), sort_keys=True, indent=4)