Exemplo n.º 1
0
class GitHubCredentials(Credentials):
    __credentials = ConfigurationPanda(['PROGRAM_CREDENTIALS'])

    def __init__(self):
        pass

    def tokens(self) -> str:
        api_key = GitHubCredentials.__credentials.tokens["github"]
        return str(api_key)
"""
This module interacts with the Github API to demonstrate
interaction with RESTful web services.
"""

import requests

from configuration_panda import ConfigurationPanda

credentials = ConfigurationPanda(['PROGRAM_CREDENTIALS'])


class Github:
    """
    Provides access to the Github API.

    Class Attributes:
        urls: Github API url templates for accessing various functionality.

    Attributes:
        oauth_token: A valid OAuth oauth_token for access the API.

    Methods:
        user_info: Provide information on a given Github user.
        user_repos: Provide information on a given users repositories.
        repo_issues: Provide information on a given repo's issues.
    """
    urls = requests.get("https://api.github.com").json()

    def __init__(self, oauth_token: str):
        self.oauth_token = oauth_token