コード例 #1
0
ファイル: github_email.py プロジェクト: breckwagner/snippets
def get_github_email(username):
    """Search for a users email address associated with their GitHub account.

    Args:
            username (str): The username to search against.

    Returns:
            str: The email address associated with the GitHub account.
    """
    request_list = [
        'https://api.github.com/users/' + username +
        "?access_token=c7e193b251fbb52b6eea346bb830bf105695c184",
        'https://api.github.com/users/' + username +
		'/events/public?access_token=c7e193b251fbb52b6eea346bb830bf105695c184']

    for url in request_list:
        request = requests.get(url)
        data = json.loads(request.text)
        result = deep_search.search(data, "email")
        if result != ("" or None):
            return result
コード例 #2
0
def get_github_email(username):
    """Search for a users email address associated with their GitHub account.

    Args:
            username (str): The username to search against.

    Returns:
            str: The email address associated with the GitHub account.
    """
    ACCESS_TOKEN = "YOUR TOKEN HERE"
    request_list = [
        'https://api.github.com/users/' + username +
        '?access_token=' + ACCESS_TOKEN,
        'https://api.github.com/users/' + username +
		'/events/public?access_token=' + ACCESS_TOKEN]

    for url in request_list:
        request = requests.get(url)
        data = json.loads(request.text)
        result = deep_search.search(data, "email")
        if result != ("" or None):
            return result
コード例 #3
0
def get_github_email(username):
    """Search for a users email address associated with their GitHub account.

    Args:
            username (str): The username to search against.

    Returns:
            str: The email address associated with the GitHub account.
    """
    ACCESS_TOKEN = "YOUR TOKEN HERE"
    request_list = [
        'https://api.github.com/users/' + username + '?access_token=' +
        ACCESS_TOKEN, 'https://api.github.com/users/' + username +
        '/events/public?access_token=' + ACCESS_TOKEN
    ]

    for url in request_list:
        request = requests.get(url)
        data = json.loads(request.text)
        result = deep_search.search(data, "email")
        if result != ("" or None):
            return result