Skip to content

Instantly share code, notes, and snippets.

@marusinm
Last active June 23, 2019 20:03
Show Gist options
  • Save marusinm/704f04c66faf686a3268f8498415d343 to your computer and use it in GitHub Desktop.
Save marusinm/704f04c66faf686a3268f8498415d343 to your computer and use it in GitHub Desktop.
Functions for creating ogr library services
def get_github_project(username, repository, token):
"""
Create project's instance for communication with Github repository
:param username: str
:param repository: str, username or organisation
:param token: str, github token
:return: project instance
"""
service = GithubService(token=token)
github_project = service.get_project(
repo=repository,
namespace=username
)
return github_project
def get_pagure_project(username, repository, token):
"""
Create project's instance for communication with Pagure repository
:param username: str
:param repository: str, username
:param token: str, pagure project token
:return: project instance
"""
service = PagureService(token=token, instance_url="https://pagure.io")
pagure_project = service.get_project(
repo=repository,
username=username,
namespace=None
)
return pagure_project
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment