Advertisement
Guest User

Untitled

a guest
Sep 22nd, 2017
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. PUT /user/starred/:owner/:repo
  2.  
  3. import requests
  4.  
  5. class Github:
  6. def __init__(self, token, api_url='https://api.github.com'):
  7. self.token = token
  8. self.api_url = api_url
  9. self.headers = {
  10. 'Accept': 'application/vnd.github.v3+json',
  11. 'Authorization': 'token ' + self.token
  12. }
  13.  
  14. def star(self, repo, owner):
  15. requests.put(f"{self.api_url}/user/starred/{owner}/{repo}",
  16. headers=self.headers).raise_for_status()
  17.  
  18. import os
  19.  
  20. github = Github(os.environ['GITHUB_OAUTH_TOKEN'])
  21. github.star(repo='cpython', owner='python')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement