Advertisement
Guest User

Untitled

a guest
Mar 1st, 2016
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.07 KB | None | 0 0
  1. #!/usr/bin/env python
  2.  
  3. from github3 import authorize, repository, login
  4. from pprint import PrettyPrinter as ppr
  5. import github3
  6. from getpass import getuser
  7.  
  8. pp = ppr(indent=4)
  9.  
  10.  
  11. username = 'myusername'
  12. password = 'mypassword'
  13. scopes = ['user', 'repo', 'admin:public_key', 'admin:repo_hook']
  14. note = 'github3.py test'
  15. note_url = 'http://github.com/FreddieV4'
  16.  
  17. print("Attemping authorization...")
  18.  
  19.  
  20. token = id = ''
  21. with open('CREDENTIALS.txt', 'r') as fi:
  22. token = fi.readline().strip()
  23. id = fi.readline().strip()
  24.  
  25.  
  26. print("AUTH token {}nAUTH id {}n".format(token, id))
  27.  
  28.  
  29. print("Attempting login...n")
  30. fv4 = login(username, password, token=token)
  31. print("Login successful!", str(fv4), 'n')
  32.  
  33.  
  34. print("Attempting auth...n")
  35. auth = fv4.authorization(id)
  36. print("Auth successful!", auth, 'n')
  37.  
  38.  
  39. print("Reading repo...n")
  40. repo = repository('Django', auth)
  41. print("Repo object...{}nn".format(dir(repo)))
  42.  
  43.  
  44. print("Repo...{}nn".format(repo))
  45. contents = repo.contents('README.md')
  46.  
  47.  
  48. pp.pprint('CONTENTS {}'.format(contents))
  49.  
  50.  
  51. contents.update('Testing github3.py', contents)
  52.  
  53. #print("commit: ", commit)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement