mirror of
https://github.com/nexus-stc/hyperboria
synced 2024-12-22 01:27:46 +01:00
20 lines
561 B
Python
20 lines
561 B
Python
|
from typing import AsyncIterable
|
||
|
|
||
|
from nexus.pylon.sources.base import (
|
||
|
DoiSource,
|
||
|
PreparedRequest,
|
||
|
)
|
||
|
|
||
|
|
||
|
class BiorxivSource(DoiSource):
|
||
|
base_url = 'https://dx.doi.org'
|
||
|
|
||
|
async def resolve(self) -> AsyncIterable[PreparedRequest]:
|
||
|
async with self.get_resolve_session() as session:
|
||
|
url = f'{self.base_url}/{self.doi}'
|
||
|
async with session.get(
|
||
|
url,
|
||
|
timeout=self.resolve_timeout
|
||
|
) as resp:
|
||
|
yield PreparedRequest(method='get', url=str(resp.url) + '.full.pdf')
|