Beispiel #1
0
def api_call_with_curl(url: str, parameters: dict) -> dict:
    # print('#', url)
    # print('#', parameters)
    params_str = '&'.join(f"{k}={v}" for k, v in parameters.items())
    cmd = f'curl --silent -H "X-CMC_PRO_API_KEY: {API_KEY}" -H "Accept: application/json" -d "{params_str}" -G {url}'
    try:
        # print('#', cmd)
        response = utils.get_simple_cmd_output(cmd)
        # print('#', response)
        return json.loads(response)  # type: ignore
    except Exception as e:
        print(e)
        return dict()  # empty dictionary
Beispiel #2
0
def api_query_with_curl(method) -> dict:
    if method.split('/')[0][0:6] == 'market':
        url = f"{URL}{method}/"
        cmd = f'curl --silent -G {url}'
        try:
            # print('#', cmd)
            response = utils.get_simple_cmd_output(cmd)
            # print('#', response)
            return json.loads(response)  # type: ignore
        except Exception as e:
            print(e)
            return dict()  # empty dictionary
    # endif

    return dict()  # empty dictionary
Beispiel #3
0
def read_clipboard():
    """Read content of 'clipboard'."""
    cmd = 'xsel -bo'
    return utils.get_simple_cmd_output(cmd)
Beispiel #4
0
def read_primary():
    """Read content of 'primary'."""
    cmd = 'xsel -po'
    return utils.get_simple_cmd_output(cmd)
def read_clipboard():
    """Read content of 'clipboard'."""
    cmd = 'xsel -bo'
    return utils.get_simple_cmd_output(cmd)
def read_primary():
    """Read content of 'primary'."""
    cmd = 'xsel -po'
    return utils.get_simple_cmd_output(cmd)