crunpyroll icon indicating copy to clipboard operation
crunpyroll copied to clipboard

session expires after 5 minutes

Open italiardam opened this issue 1 year ago • 1 comments

the session seems to expire after 5 minutes

I tried to do a test by adding a 6 minute sleep to the code provided as an example

code:

async def main(): # Start client and login await client.start() await asyncio.sleep(360) # Search for Attack on Titan query = await client.search("Attack On Titan") series_id = query.items[0].id print(series_id) # Retrieve all seasons of the series seasons = await client.get_seasons(series_id) print(seasons)

asyncio.run(main())

output:

Traceback (most recent call last): File "/root/test.py", line 25, in asyncio.run(main()) File "/usr/lib/python3.10/asyncio/runners.py", line 44, in run return loop.run_until_complete(main) File "/usr/lib/python3.10/asyncio/base_events.py", line 649, in run_until_complete return future.result() File "/root/test.py", line 18, in main query = await client.search("Attack On Titan") File "/root/crunpyroll/methods/search.py", line 42, in search await self.session.retrieve() File "/root/crunpyroll/session.py", line 41, in retrieve await self.refresh() File "/root/crunpyroll/session.py", line 69, in refresh response = await self._client.api_request( File "/root/crunpyroll/client.py", line 89, in api_request return Client.parse_response(response) File "/root/crunpyroll/client.py", line 62, in parse_response raise CrunpyrollException(message) crunpyroll.errors.CrunpyrollException: [401] {"code":"auth.obtain_access_token.missing_client_credential","context":[{"code":"auth.obtain_access_token.missing_client_credentials","field":"Authorization"}],"error":"invalid_client"}

I tried adding a print to "{self.expiration}" in the "authorize" function in the "session.py" file to see the expiration of the session at the time of authentication and apparently the session always lasts 5 minutes

italiardam avatar Jan 28 '24 16:01 italiardam

Thank you for your feedback. This issue shpuld be resolved in 2.3.3. Please, update the library and try again.

stefanodvx avatar Feb 10 '24 14:02 stefanodvx