Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- cranc.py:
- project = "carrot"
- username = "lenkaseg"
- api_token = '0F20I39PFUN7VR0M1H1IJM9NQQRYNW6ZZQOPIK1KWM8EZW53T0D9RW3PH94S0DFG'
- _log = logging.getLogger(__name__)
- # Creating a Pagure object
- PAGURE = libpagure.Pagure(pagure_token=api_token, pagure_repository=project, fork_username=username)
- # Create subgroup 'create'
- @click.group()
- def create():
- pass
- @click.command(name="pr")
- @click.option("--repo")
- @click.option("--title")
- @click.option("--branch_to")
- @click.option("--branch_from")
- def create_pr(repo, title, branch_to, branch_from):
- """this command creates a new pull request"""
- try:
- request = PAGURE.create_pull_request(repo=repo, title=title, branch_to=branch_to,
- branch_from=branch_from)
- pprint.pprint(request)
- except Exception:
- _log.exception("Failed to connect to the server")
- # Adding create_pr into the group 'create'
- create.add_command(create_pr)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement