Module ieugwaspy.api

API management

Expand source code
"""API management
"""
import ieugwaspy.constants as cons
import webbrowser, os


def toggle_api(url="prod"):
    """Toggle API URL (no return value)

    Parameters:
        url: the short name for the required API url

    """
    if url in cons.urls.keys():
        cons.option["mrbaseapi"] = cons.urls[url]


def get_api_token():
    webbrowser.open(cons.api_token_url)
    return input("Paste API token: ")

Functions

def get_api_token()
Expand source code
def get_api_token():
    webbrowser.open(cons.api_token_url)
    return input("Paste API token: ")
def toggle_api(url='prod')

Toggle API URL (no return value)

Parameters

url
the short name for the required API url
Expand source code
def toggle_api(url="prod"):
    """Toggle API URL (no return value)

    Parameters:
        url: the short name for the required API url

    """
    if url in cons.urls.keys():
        cons.option["mrbaseapi"] = cons.urls[url]