Python Forum

Full Version: webautomation with an API
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Good morning,

I'll just come straight up to my question.

Does webautomation (especially for automation in browsergames) properly work with an API?
As far as I'm aware of, does the session ends as soon as the program is done.

for example:
I have a script which signs in to a website, and reads the first 5 articles.
Cookies/tokens will be the same as long as the program is running.
Once I re-run it, every token etc. changes to a different value.


Doesnt that occur to an API aswell?
I have my front-end, click the button get 5 latest articles -> request to my own API -> API signs in to website -> fetches the 5 articles and returns the value to my frontend. => Session ends

Is there any way how I can keep the session alive?
Or is that simply not possible.


Thanks for all answers!
Sessions aren't part of HTTP; they're layered on top by the application if it needs them (e.g. with cookies). As such, it's up to the backend what session management it has, how long you can keep the session alive, etc. Of course, if it's your backend, then you're in control and can implement whatever you like.