Config
FIO Wrapper internally uses a configuration file to provide its standard capabilities. The configuration can be overwritten by the user.
base.yml
Config() class
Config
FIO Wrapper configuration class
Attributes:
Name | Type | Description |
---|---|---|
_api_key |
str
|
FIO API key |
_version |
str
|
FIO API version |
_application |
str
|
Application name |
_base_url |
str
|
FIO base url |
_timeout |
float
|
FIO generic timeout |
_ssl_verify |
bool
|
Request ssl verification |
data |
ConfigParser
|
Configuration Parser |
Initializes the configuration
Parameters:
Name | Type | Description | Default |
---|---|---|---|
api_key |
Optional[str]
|
FIO API key. Defaults to None. |
None
|
version |
Optional[str]
|
FIO API version. Defaults to None. |
None
|
application |
Optional[str]
|
Application name. Defaults to None. |
None
|
base_url |
Optional[str]
|
FIO base url. Defaults to None. |
None
|
timeout |
Optional[float]
|
FIO generic timeout. Defaults to 10.0. |
10.0
|
ssl_verify |
Optional[bool]
|
Request ssl verification. Defaults to True. |
True
|
user_config |
Optional[str]
|
User configuration file. Defaults to None. |
None
|
Source code in fio_wrapper/config.py
versions
property
Gets the versions information from config
Raises:
Type | Description |
---|---|
SystemExit
|
No list of available FIO versions provided |
Returns:
Type | Description |
---|---|
List[str]
|
List[str]: List of versions |
api_key
property
Gets the FIO API key
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
FIO API key or None |
version
property
Gets the FIO version specified
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
FIO API version |
application
property
Gets the application name
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
Application name |
base_url
property
Gets the FIO base url
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
FIO base url |
timeout
property
Gets the timeout parameter
Returns:
Name | Type | Description |
---|---|---|
float |
float
|
Timeout parameter |
ssl_verify
property
Gets the ssl verification parameter
Returns:
Name | Type | Description |
---|---|---|
float |
float
|
Seconds as float of request timeout |
cache
property
Gets the cache usage status
Returns:
Name | Type | Description |
---|---|---|
bool |
bool
|
Cache used, true or false |
cache_default_expire
property
Gets the cache default expiration time
Returns:
Name | Type | Description |
---|---|---|
int |
int
|
Expiration time in seconds |
data_merge
merges b into a and return merged result
Parameters:
Name | Type | Description | Default |
---|---|---|---|
a |
Dict
|
First dictionary |
required |
b |
Dict
|
Second dictionary |
required |
NOTE
tuples and arbitrary objects are not handled as it is totally ambiguous what should happen
Source code in fio_wrapper/config.py
get
Gets a configuration element
Parameters:
Name | Type | Description | Default |
---|---|---|---|
section |
str
|
Configuration section |
required |
option |
str
|
Configuration option |
required |
Raises:
Type | Description |
---|---|
UnknownConfig
|
Configuration not found |
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
Configuration element |
Source code in fio_wrapper/config.py
get_url
Gets a url configuration element
Parameters:
Name | Type | Description | Default |
---|---|---|---|
option |
str
|
Configuration option |
required |
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
URL configuration parameter |
Source code in fio_wrapper/config.py
cache_url_expirations
Creates the dict for requests_cache url expirations
Returns:
Type | Description |
---|---|
Dict[str, any]
|
Dict[str, any]: URL specific expiration settings |