Last active
June 23, 2019 20:03
-
-
Save marusinm/704f04c66faf686a3268f8498415d343 to your computer and use it in GitHub Desktop.
Functions for creating ogr library services
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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