Connections
eternaltwin.connections.connections
module-attribute
Global instance holding all the synchronous connections configured with configure().
eternaltwin.connections.async_connections
module-attribute
Global instance holding all the asynchronous connections configured with configure().
eternaltwin.connections.Connections
Bases: Generic[Client]
Holds connections to different EternalTwin API.
configure
Configure multiple clients at once.
Useful for passing in config dictionaries obtained from other sources, like Django's settings or a configuration management tool. Overwrite all existing connections.
Examples:
ETERNALTWIN_CONFIG = {
"default": {
'url': 'https://eternaltwin.org/api/v1/',
'client_id': "myclient",
'client_secret': 'mysecret',
'state_key': HS256Key("mykey"),
'redirect_uri': 'https://myapp.com/callback',
},
"test": {
'url': 'http://localhost:50321/api/v1"',
'client_id': "myclient",
'client_secret': 'mysecret',
'redirect_uri': 'https://localhost:8080/callback',
'state_key': HS256Key("mykey"),
'timeout': 1,
'verify_ssl': False,
'allow_redirects': True,
}
}
connections.configure(**ETERNALTWIN_CONFIG)
create_connection
Create a client and register it under given alias.