Advertisement
lenkaseg

Untitled

Jan 16th, 2019
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 KB | None | 0 0
  1. cranc.py:
  2.  
  3. project = "carrot"
  4. username = "lenkaseg"
  5. api_token = '0F20I39PFUN7VR0M1H1IJM9NQQRYNW6ZZQOPIK1KWM8EZW53T0D9RW3PH94S0DFG'
  6.  
  7. _log = logging.getLogger(__name__)
  8.  
  9. # Creating a Pagure object
  10. PAGURE = libpagure.Pagure(pagure_token=api_token, pagure_repository=project, fork_username=username)
  11.  
  12.  
  13. # Create subgroup 'create'
  14. @click.group()
  15. def create():
  16. pass
  17.  
  18. @click.command(name="pr")
  19. @click.option("--repo")
  20. @click.option("--title")
  21. @click.option("--branch_to")
  22. @click.option("--branch_from")
  23. def create_pr(repo, title, branch_to, branch_from):
  24. """this command creates a new pull request"""
  25. try:
  26. request = PAGURE.create_pull_request(repo=repo, title=title, branch_to=branch_to,
  27. branch_from=branch_from)
  28. pprint.pprint(request)
  29. except Exception:
  30. _log.exception("Failed to connect to the server")
  31.  
  32. # Adding create_pr into the group 'create'
  33. create.add_command(create_pr)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement