python-dependency-injector/examples/di_demo2/example_di.py

19 lines
352 B
Python
Raw Normal View History

2020-08-15 18:01:58 +03:00
import os
2020-08-14 22:45:30 +03:00
class ApiClient:
def __init__(self, api_key: str, timeout: int):
self.api_key = api_key
self.timeout = timeout
class Service:
def __init__(self, api_client: ApiClient):
self.api_client = api_client
2020-08-15 18:01:58 +03:00
if __name__ == '__main__':
service = Service(ApiClient(os.getenv('API_KEY'), os.getenv('TIMEOUT')))