feat: implement WebADIS authentication and add medianumber retrieval functionality

This commit is contained in:
2025-10-21 15:26:20 +02:00
parent 0764a6b06a
commit f63bcc8446
12 changed files with 323 additions and 9 deletions

View File

@@ -1,3 +1,4 @@
from enum import Enum
from typing import Any, Optional, Union
import requests
@@ -33,6 +34,14 @@ RATE_LIMIT = 20
RATE_PERIOD = 30
class TransformerType(Enum):
ARRAY = "ARRAY"
COinS = "COinS"
BibTeX = "BibTeX"
RIS = "RIS"
RDS = "RDS"
class WebRequest:
def __init__(self) -> None:
"""Request data from the web, and format it depending on the mode."""
@@ -185,10 +194,16 @@ class BibTextTransformer:
ValueError: Raised if mode is not in valid_modes
"""
valid_modes = ["ARRAY", "COinS", "BibTeX", "RIS", "RDS"]
valid_modes = [
TransformerType.ARRAY,
TransformerType.COinS,
TransformerType.BibTeX,
TransformerType.RIS,
TransformerType.RDS,
]
def __init__(self, mode: str = "ARRAY") -> None:
self.mode = mode
def __init__(self, mode: TransformerType = TransformerType.ARRAY) -> None:
self.mode = mode.value
self.field = None
self.signature = None
if mode not in self.valid_modes: