-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample.py
More file actions
18 lines (15 loc) · 739 Bytes
/
example.py
File metadata and controls
18 lines (15 loc) · 739 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
from bind import API, Request
from bind.callbacks import response_to_json, request_to_formdata
class GithubAPI(API):
BASE_URL = "https://github.com/api/v2/json"
RESPONSE_CALLBACK = response_to_json
get_user_data = Request("/user/show/:user", "GET")
get_user_data_extra = Request("/user/show", "GET", requires_auth=True)
comment_on_issue = Request("/issues/comment/:user/:repo/:id", "POST",
request_callback=request_to_formdata,
requires_auth=True)
if __name__ == '__main__':
gh = GithubAPI()
gh.authenticate("<username>", "<password>")
comment = {"comment":"test comment"}
print gh.comment_on_issue(comment, repo="somerepo", id="someid")