unpywall icon indicating copy to clipboard operation
unpywall copied to clipboard

Handle connection errors in cache?

Open bganglia opened this issue 4 years ago • 8 comments

Failed requests should not be saved.

A report should be generated with the DOIs that have led to failed requests.

This was raised as part of the discussion in issue #12

bganglia avatar Apr 15 '20 17:04 bganglia

@naustica Could you talk a little bit more about what you mean by a report?

bganglia avatar Apr 15 '20 18:04 bganglia

something like: Report

Out of seven dois, two were invalid.

doi error
10.3253/dga.dsfs Unpaywall response
10.214134/afsaf Timeout...

Or do you have a better idea?

naustica avatar Apr 15 '20 18:04 naustica

ok, the table has just been converted to markdown. Imagine that as a plain python table

naustica avatar Apr 15 '20 18:04 naustica

Ok. Right now dois are requested one-by-one, so I guess it would make sense to add a function that takes in a list of dois and then prints this report to the console, if the console is the best place.

bganglia avatar Apr 15 '20 19:04 bganglia

@naustica What do you think about just a warning?

bganglia avatar Apr 15 '20 20:04 bganglia

@bganglia I dont know. I associate warnings with internal problems. But this is more of an external one. Or? But we can do that.

naustica avatar Apr 16 '20 08:04 naustica

@naustica Now that I think about it, a report would probably be easier to read anyway. Printing out a report sounds good to me.

bganglia avatar Apr 16 '20 12:04 bganglia

@bganglia Python provides also the tempfile module (https://docs.python.org/3.7/library/tempfile.html) which creates a temporary file that we could use to store dois from faulty connections. So we can create a temporary txt file that the user has access to. The tempfile would only exist for one session (I think) which is also nice.

naustica avatar Apr 21 '20 21:04 naustica