Skip to content

Instantly share code, notes, and snippets.

@dannyOhNo
dannyOhNo / example.json
Last active February 22, 2017 18:17
Github Token Search Example Output
[
{
"client_id": "398oijosdi883798798sd",
"name": "PokitDok Test App",
"html_url": "https://github.com/pokitdok/pokitdok-csharp/blob/master/example/ConsoleApplication1/Program.cs"
}
]
@dannyOhNo
dannyOhNo / main.py
Last active February 22, 2017 18:04
Main Body
detected_apps = []
for app in apps:
client_id = app.get('client_id')
name = app.get('name')
result_raw = make_request(client_id)
if result_raw.status_code == 200:
html_url = parse_response(result_raw.text)
if html_url:
@dannyOhNo
dannyOhNo / methods.py
Last active February 22, 2017 18:06
Github Code Search
def make_request(client_id):
result_raw = requests.get(
'https://api.github.com/search/code?q={0}'.format(client_id),
headers={"Authorization": "token {}".format(GITHUB_PERSONAL_ACCESS_TOKEN)}
)
return result_raw
def parse_response(text):
result = json.loads(text)
html_url = result.get('items')[0].get('html_url')
@dannyOhNo
dannyOhNo / search ex.
Last active February 22, 2017 16:59
github search
GET /search/code