Configuration
Configuration Overview
aioarxiv uses pydantic_settings
for configuration management. All settings can be configured through:
Environment variables (with
ARXIV_
prefix).env
fileDirect code configuration
Configuration Model Settings
The configuration model uses the following settings:
env_prefix
: "ARXIV_" (prefix for environment variables)env_file_encoding
: "utf-8" (encoding for .env file)case_sensitive
: False (case-insensitive environment variables)env_file
: ".env" (default environment file name)extra
: "allow" (allows additional configuration fields)
Configuration Details
Parameter | Description | Type | Default | Constraint | Environment Variable |
---|---|---|---|---|---|
base_url | Base URL for the arXiv API | string |
| - |
|
timeout | API request timeout in seconds | float |
| gt=0 (greater than 0) |
|
timezone | Timezone setting | string |
| - |
|
max_retries | Maximum number of retry attempts for failed requests | integer |
| ge=0 (greater than or equal to 0) |
|
rate_limit_calls | Maximum number of requests within the rate limit window | integer |
| ge=0 (greater than or equal to 0) |
|
rate_limit_period | Rate limit window period in seconds | float |
| ge=0 (greater than or equal to 0) |
|
max_concurrent_requests | Maximum number of concurrent requests | integer |
| - |
|
proxy | HTTP/HTTPS proxy URL | string | None |
| - |
|
log_level | Logging level | string |
| - |
|
page_size | Number of results per page | integer |
| - |
|
min_wait | Minimum wait time between retries in seconds | float |
| gt=0 (greater than 0) |
|
Configuration Examples
Basic Configuration:
from aioarxiv import ArxivConfig config = ArxivConfig( timeout=60.0, max_retries=5, log_level="DEBUG" )Proxy Configuration:
from aioarxiv import ArxivConfig config = ArxivConfig( proxy="http://localhost:8080", timeout=60.0, max_retries=5 )Rate Limiting:
from aioarxiv import ArxivConfig config = ArxivConfig( rate_limit_calls=2, rate_limit_period=5.0, max_concurrent_requests=2 )
The configuration object can be passed to the client instance: