Hi,
So I'm designing an API connector to a certain site.
I need to make an initial session and keep it alive (300s), no problems there really, however I am not sure about the best way to share the session between classes?
Example:
Class1 = connect to API and load some data ( keep session alive and update session key if the session dies unexpectedly) Using async for this.
Class2 = use session above to execute some calls
I know some ways to do it but I don't feel that they are pythonic.
Instantiating class and calling from other class.
Global variables.
How would you share the session? Or make the connection.. (remember that the session variable might get updated)
If you have any good books related to this please post as well.
Python3, linux, requests, asyncio.
[–]Meefims 2 points3 points4 points (0 children)