rafguns / doidownloader

You give it DOIs, it gives you the article PDFs
MIT License
0 stars 0 forks source link

Investigate: do we need an async context manager? #11

Closed rafguns closed 1 year ago

rafguns commented 1 year ago

Is it useful if we're able to write:

async with DOIDownloader() as client:
    ...

This is more complex than simply replacing __enter__ and __exit__ with __aenter__ and __aexit__; I got an error that __await__ was also expected? To investigate further.

rafguns commented 1 year ago

I probably did something wrong the previous time (most likely forgot an await somewhere). This seems to work now in branch 'asynccontextmgr'.