Configuration
Configuration for accessing Rune APIs.
- class runeq.config.Config(*args, **kwargs)
Holds configuration for Rune API usage (e.g. auth credentials, URLs, etc)
- __init__(*args, **kwargs)
Initialize configuration options.
- Parameters
*args – Accepts at most 1; a filename. If provided, values will be loaded from the file, using load_yaml(). It is invalid to provide both a filename and keyword arguments.
**kwargs – Passed to set_values().
Examples
There are three valid ways to create a config:
>>> cfg = Config() # Load from default file location (~/.rune/config)
>>> cfg = Config('./example_config.yaml') # Load from a specified YAML file
>>> cfg = Config(access_token_id='foo', access_token_secret='bar') # Set values using keyword arguments. This can be used with any # valid combination of config options; the example above sets a # user access token.
- property auth_headers
Authentication headers for HTTP requests to Rune APIs.
- load_yaml(filename='~/.rune/config')
Set values from a YAML file. Keys from the file are passed directly to set_values(), as kwargs.
- Parameters
filename – File path for a YAML-formatted config file
- set_values(auth_method=None, access_token_id=None, access_token_secret=None, client_key_id=None, client_access_key=None, jwt=None, cognito_client_id=None, cognito_refresh_token=None, cognito_region_name='us-west-2', stream_url=None, graph_url=None, **kwargs)
Set configuration values.
- Parameters
auth_method – What type of authentication credentials to use. Must be one of ‘access_token’, ‘client_keys’, or ‘jwt’. If not set, the auth method is inferred based on which credentials are specified (as long as it’s unambiguous).
access_token_id – User access token ID
access_token_secret – User access token secret
client_key_id – Client key ID
client_access_key – Client access key
jwt – JWT
stream_url – base URL to use for the stream API
graph_url – base URL to use for the graph API
**kwargs – Arbitrary values may be provided, but they are ignored.