pybliometrics-dev / pybliometrics

Python-based API-Wrapper to access Scopus
https://pybliometrics.readthedocs.io/en/stable/
Other
407 stars 127 forks source link

Improve requests handling #261

Closed raffaem closed 2 years ago

raffaem commented 2 years ago

Set a Session, which is faster than rebuilding it all the time

Set a timeout to avoid requests hanging wainting a response

raffaem commented 2 years ago

See here

Michael-E-Rose commented 2 years ago

This seem like a good idea! But where does the 20 come from?

raffaem commented 2 years ago

This seem like a good idea! But where does the 20 come from?

nowhere. We should probably have it set in config.ini

Michael-E-Rose commented 2 years ago

No, I mean why did you choose 20? Is this based on something?

raffaem commented 2 years ago

No, I mean why did you choose 20? Is this based on something?

No it's not based on anything.

I thought it would be a good idea to wait 20 seconds and then infer that the packet will never arrive.

It seems to work right now, in the sense before the download got blocked indefinitely (so it did not resume after 21 seconds or 22 seconds), while now it will restart after a wait of 20 seconds and then proceed (of course I'm catching the exception that this is throwing).

There is probably a lower number that still guarantees that if the packet did not arrive by that time, it will never arrive.

Michael-E-Rose commented 2 years ago

It's a very good improvement overall. The 20 seconds looks arbitrary though. I will implement a way to set the timeout in config.ini.

owoodhansen commented 2 years ago

Not an experienced github user, sorry, but whats the process/expected timeframe for integrating this to the stable version? Thanks for a great wrapper package! And to Rafaem for adding sessions - I was just about to try to do so myself.

Michael-E-Rose commented 2 years ago

Yeah there's only one last step left for me to do, namely to parameterize the timeout in configuration file. Yet on the last months I was busy with Ukraine and family growth. I try to deliver this in this month. Promised

owoodhansen commented 2 years ago

I didn’t mean to put any pressure on you sorry. There are more important things in the world than Github😊 I was just curious when.

Again, thank you

From: Michael E. Rose @.> Sent: 09 June 2022 11:50 To: pybliometrics-dev/pybliometrics @.> Cc: owlonewolf @.>; Comment @.> Subject: Re: [pybliometrics-dev/pybliometrics] Improve requests handling (PR #261)

Yeah there's only one last step left for me to do, namely to parameterize the timeout in configuration file. Yet on the last months I was busy with Ukraine and family growth. I try to deliver this in this month. Promised

— Reply to this email directly, view it on GitHubhttps://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fpybliometrics-dev%2Fpybliometrics%2Fpull%2F261%23issuecomment-1150913265&data=05%7C01%7C%7C326aab6e0a7e49c8613308da49fd7078%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637903650105611059%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=etnfaHCJAKyxx2%2FLzpyN3P%2Bn4Ve9R9RMmpUP7vdn3mw%3D&reserved=0, or unsubscribehttps://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAJKF5VYDTXZSDSYCQRS6RU3VOG45BANCNFSM5UMT4BQA&data=05%7C01%7C%7C326aab6e0a7e49c8613308da49fd7078%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637903650105611059%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=eRD7kv%2Bel130M0sHIaQPWyxIM0m70ijyGZsk699QcRA%3D&reserved=0. You are receiving this because you commented.Message ID: @.**@.>>