Code Monkey home page Code Monkey logo

Comments (10)

sckott avatar sckott commented on August 16, 2024

Thank you for the report @vgreg

Can you please share a reproducible example that caused this error? Seems like the except's aren't catching whatever error is thrown and then we don't have r defined. It'd be nice to have an example to figure out what that error is

from habanero.

vgreg avatar vgreg commented on August 16, 2024

I am still looking for an example that will consistently reproduce the error. I was retrieving all articles for a set of about 150 journals and had the error occur for two journals, but I have been to re-run the request for both with no issue the second time.

Here is a simplified version of a request that failed once but has been working every other time:

from habanero import Crossref
cr = Crossref()
query = {"issn": "0028-3932"}


responses = cr.works(
    filter=query, cursor="*", cursor_max=12000
)

cursor_max is set to slightly more than the number of DOIs for the journal.

from habanero.

sckott avatar sckott commented on August 16, 2024

Thanks - I'll see if I can get that to fail

from habanero.

sckott avatar sckott commented on August 16, 2024

This may be difficult to track down - the facat that it doesn't happen consistently suggests it's an intermittent problem with the Crossref API

from habanero.

vgreg avatar vgreg commented on August 16, 2024

I was able to reproduce a similar error and see what gets printed on line 163. Here is the exception:

HTTPSConnectionPool(host='api.crossref.org', port=443): Max retries exceeded with url:
/works?filter=issn%3A0028-3932&cursor=DnF1ZXJ5VGhlbkZldGNoBgAAAAAFuuH-Fmx3VDZUUHY5VHlhdThmaGVtbFhBOVEAAAAABcXycBZPY3FES3VMU1R5R3JIWHlwQUZBcktnAAAAAAXd460WTUpsaGN0RGFRbS1yN0ZYWTJ3MG5pUQAAAAAGAprKFlVTQUNpdVFEVHZLdWVZQWxVZEJDUUEAAAAABbl
xaxY0bldDU3pmSlJZeWhaSGk2VHVVdHh3AAAAAAW0yJAWaUpOMms5em5SUmVMR2JjT2VGdEFtdw%3D%3D (Caused by ConnectTimeoutError(<urllib3.connection.HTTPSConnection object at 0xffff33f68e90>, 'Connection to api.crossref.org timed out. (connect
timeout=None)'))

It seems that ConnectTimeout is derived from RequestException, so it is caught on line 162:
https://requests.readthedocs.io/en/latest/api/#requests.ConnectionError

However, the code continues to line 164 with r still undefined.

from habanero.

sckott avatar sckott commented on August 16, 2024

Okay, thanks for this. I'll try to get to this soon

from habanero.

sdspieg avatar sdspieg commented on August 16, 2024

Having the same issue...

HTTPSConnectionPool(host='api.crossref.org', port=443): Max retries exceeded with url: /works?query=author%3AMONAGHAN+A%2BAND%2Btitle%3A%E2%80%98CALMLY+CRITICAL%E2%80%99%3A+EVOLVING+RUSSIAN+VIEWS+OF+US+HEGEMONY%2BAND%2Byear%3A2006%2BAND%2Bjournal%3AJOURNAL+OF+STRATEGIC+STUDIES&rows=1 (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f3fec6f7f70>: Failed to establish a new connection: [Errno 101] Network is unreachable'))
An error occurred: local variable 'r' referenced before assignment

Let me know if I can help with debugging (but the run continues despite the error...)

from habanero.

sckott avatar sckott commented on August 16, 2024

thanks for your report @sdspieg ! Sorry about the issue. I started working on this, but I just haven't had time to finish it off. I'll let you know if I could use any help.

from habanero.

sckott avatar sckott commented on August 16, 2024

@vgreg @sdspieg Can both of you reinstall from Github and try again?

from habanero.

sckott avatar sckott commented on August 16, 2024

closing for now, if it pops up again ping here

from habanero.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.