|
Note
|
Secret weapon = autohotkey |
- Start
-
Open the Start screen
- Cancel
-
Cancel the current action or dialog
- Start/stop listening
| from __future__ import unicode_literals | |
| from collections import defaultdict | |
| import random | |
| import requests | |
| from graphviz import Digraph | |
| USERNAME = 'shauns' | |
| PASSWORD = '****' |
|
Note
|
Secret weapon = autohotkey |
Open the Start screen
Cancel the current action or dialog
| import urllib2 | |
| url = "http://api.example.com" | |
| req = urllib2.Request(url) | |
| req.add_header("Accept", "application/json") | |
| req.add_header("Content-Type", "application/x-www-form-urlencoded") | |
| req.add_header("Authorization", "Bearer 591768b9-a3ad-443c-a60c-33ccdabb6cce") | |
| res = urllib2.urlopen(req) |
| import urllib2, base64 | |
| request = urllib2.Request("http://api.url") | |
| base64string = base64.encodestring('%s:%s' % (username, password)).replace('\n', '') | |
| request.add_header("Authorization", "Basic %s" % base64string) | |
| result = urllib2.urlopen(request) |
Ever had the need to create a branch in a repo on Github without wanting (or being able) to access a local repo?
With the aid of [the Github API][1] and any online request app this is a piece of cake!
Just follow these steps:
https://api.github.com/repos/<AUTHOR>/<REPO>/git/refs/headshttps://api.github.com/repos/<AUTHOR>/<REPO>/git/refs with the following as the POST body :| #!/usr/bin/env python | |
| # -*- coding: utf-8 -*- | |
| #Requires python >=2.6 | |
| """ | |
| Tool to convert github issues to pull requests by attaching code. Uses the | |
| github v3 API. Defaults assumed for the `astropy <http://www.astropy.org>`_ | |
| project. | |
| """ | |
| from __future__ import print_function |
| data = { | |
| "active": true, | |
| "config": {"url": "http://postbin.ep.io/33/"}, | |
| "name": "trac", | |
| "events": ['pull_request', 'issue_comment', 'issues'], | |
| } | |
| requests.post('https://api.github.com/repos/django/django/hooks', | |
| auth = (USERNAME, PASSWORD), | |
| headers = {'Content-Type':'application/json'}, |