Module macrobond_data_api.web.web_client

Classes

class KeyringException (*args, **kwargs)

Common base class for all non-exit exceptions.

Ancestors

  • builtins.Exception
  • builtins.BaseException
class WebClient (username: str = None, password: str = None, scopes: List[Scope] = None, api_url: str = None, authorization_url: str = None, service_name: str = None, proxy: str = None)

WebClient to get data from the web

Parameters

username : str, optional
The username to use for authentication. If not specified, an attempt is made to get the credentials from the keyring
password : str, optional
The password to use for authentication. If not specified, an attempt is made to get the credentials from the keyring
scopes : List[str], optional
A list of scopes to request as part of the authorization. If not specified, all available scopes will be requested. The common scopes requires are "macrobond_web_api.read_mb" and "macrobond_web_api.search_mb"
api_url : str, optional
The URL of the API. If not specified, the default URL will be used, which is what you want in most cases.
authorization_url : str, optional
The URL of the authorization server. If not specified, the default URL will be used, which is what you want in most cases.
proxy : str, optional
For a HTTPS Proxy use https://10.10.1.10:1080 or https://user:pass@10.10.1.10:1080 For a HTTP Proxy use http://10.10.1.10:1080 or http://user:pass@10.10.1.10:1080 For a Socks5 Proxy use socks5://user:pass@host:port

Returns

WebClient
The WebClient instance

Examples

# use credentials stored in the keyring
with WebClient() as api:
    # use the api here
with WebClient('client id', 'client secret') as api:
    # use the api here

Ancestors

  • Client
  • abc.ABC
  • typing.Generic

Class variables

var configuration : Type[Configuration]

summary

Warning: This is only recommended for advanced users.

Instance variables

var is_open : bool

Methods

def close(self) ‑> None
def open(self) ‑> WebApi