-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
33 lines (22 loc) · 747 Bytes
/
Copy pathmain.py
File metadata and controls
33 lines (22 loc) · 747 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
from scottzach1.pif import providers, wiring
class ApiClient:
"""
An API client that takes a domain and token.
"""
def __init__(self, domain: str, token: str):
assert domain and token
def do_stuff(self): ...
# Define some providers to use for injection.
ApiDomainProvider = providers.Blank()
ApiTokenProvider = providers.Blank()
ApiClientProvider = providers.Singleton(ApiClient, domain=ApiDomainProvider, token=ApiTokenProvider)
@wiring.inject
def main(client: ApiClient = ApiClientProvider):
"""
Your application logic.
"""
client.do_stuff()
if __name__ == "__main__":
ApiDomainProvider.override_existing("example.domain.com")
ApiTokenProvider.override_existing("*****")
main()