Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/test_tip.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
name: Source
on: [push, release]

env:
PAPERSCRAPER_EMAIL: jannis.born@gmx.de

jobs:
test-source-install:
runs-on: ubuntu-latest
Expand Down
7 changes: 5 additions & 2 deletions paperscraper/get_dumps/utils/chemrxiv/crossref_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"""

import logging
import os
import sys
from time import sleep
from typing import Dict, Generator, List, Optional
Expand Down Expand Up @@ -58,7 +59,9 @@ def __init__(
self.end_date = end_date
self.page_size = min(max(1, page_size), 1000)
self.max_retries = max_retries
self.mailto = mailto
self.mailto = mailto or os.getenv(
"PAPERSCRAPER_EMAIL", "your_email@example.com"
)
self.request_delay_seconds = max(0.0, request_delay_seconds)

def iter_items(self) -> Generator[Dict, None, None]:
Expand Down Expand Up @@ -140,7 +143,7 @@ def _request(self, params: Dict) -> Dict:

headers = {
"Accept": "application/json",
"User-Agent": "paperscraper (Crossref fallback)",
"User-Agent": "paperscraper",
}

for attempt in range(self.max_retries):
Expand Down
3 changes: 2 additions & 1 deletion paperscraper/pdf/fallbacks.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import datetime
import io
import logging
import os
import re
import sys
import threading
Expand Down Expand Up @@ -123,7 +124,7 @@ def fallback_bioc_pmc(
bool: True if the XML file was successfully downloaded, False otherwise.
"""
ncbi_tool = "paperscraper"
ncbi_email = "your_email@example.com"
ncbi_email = os.getenv("PAPERSCRAPER_EMAIL", "your_email@example.com")

converter_url = "https://www.ncbi.nlm.nih.gov/pmc/utils/idconv/v1.0/"
params = {
Expand Down
2 changes: 1 addition & 1 deletion paperscraper/pdf/pdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ def save_pdf(
api_keys = load_api_keys(api_keys)
doi = paper_metadata["doi"]
url = f"https://doi.org/{doi}"
user_agent = {"User-Agent": "paperscraper/1.0 (+https)"}
user_agent = {"User-Agent": "paperscraper"}
success = False
metadata_written = False

Expand Down
5 changes: 4 additions & 1 deletion paperscraper/pubmed/pubmed.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@
logger = logging.getLogger(__name__)
logger.setLevel(logging.INFO)

PUBMED = PubMed(tool=os.getenv("NCBI_TOOL", "paperscraper"), email="abc@def.gh")
PUBMED = PubMed(
tool="paperscraper",
email=os.getenv("PAPERSCRAPER_EMAIL", "your_email@example.com"),
)

pubmed_field_mapper = {"publication_date": "date"}

Expand Down
Loading