Install & Compatibility
Where this runs
tested against v1.4.1 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.910 runs
installs and imports cleanly · install 0.0s · import 0.115s · 25.5MB
glibcpy 3.10–3.910 runs
installs and imports cleanly · install 2.6s · import 0.107s · 26MB
24MB installed
● package 24MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
URL
✓ from apeye.url import URL
RequestsURL
✓ from apeye.requests_url import RequestsURL
Cache
✓ from apeye.cache import Cache
RateLimitAdapter
✓ from apeye.rate_limiter import RateLimitAdapter
This quickstart demonstrates key features of apeye: using `apeye.url.URL` for constructing URLs with a `pathlib.Path`-like interface, and `apeye.requests_url.RequestsURL` for integrating with the `requests` library. It also shows a basic example of the `apeye.cache.Cache` decorator for memoizing function results.
from apeye.url import URL
from apeye.requests_url import RequestsURL
import requests
# Using URL for path-like URL manipulation
base_url = URL('https://api.example.com')
endpoint = base_url / 'v1' / 'users'
print(f"Constructed URL: {endpoint}")
# Using RequestsURL for integration with the requests library
api_url = RequestsURL('https://httpbin.org/get')
try:
# This part requires network access
response = requests.get(api_url.get_url())
response.raise_for_status()
print(f"API response (first 100 chars): {response.text[:100]}...")
except requests.exceptions.RequestException as e:
print(f"Could not fetch URL: {e}. Check your network connection.")
# Example of using the cache (requires `apeye[limiter]` for CacheControl related features if used with requests adapter,
# but the basic Cache decorator works standalone)
from apeye.cache import Cache
import os
@Cache(cache_dir='./apeye_cache')
def get_data(param: str) -> dict:
print(f"Fetching data for: {param}")
# Simulate a network request or heavy computation
import time
time.sleep(0.1)
return {'param': param, 'value': len(param)}
# Clear cache directory for a fresh run if it exists
import shutil
if os.path.exists('./apeye_cache'):
shutil.rmtree('./apeye_cache')
print(get_data('hello')) # First call, fetches data
print(get_data('hello')) # Second call, uses cache
print(get_data('world')) # New call, fetches data
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'apeye'
This error occurs when the 'apeye' package is not installed in your Python environment.
fixInstall the 'apeye' package using pip: 'python -m pip install apeye'.
ImportError: cannot import name 'URL' from 'apeye'
This error occurs when attempting to import 'URL' from 'apeye', but the correct import path is 'apeye.url'.
fixUse the correct import statement: 'from apeye.url import URL'.
ImportError: cannot import name 'RateLimitAdapter' from 'apeye'
This error occurs when the 'limiter' extra is not installed, which is required for 'RateLimitAdapter'.
fixInstall the 'limiter' extra with: 'python -m pip install apeye[limiter]'.
AttributeError: module 'apeye' has no attribute 'Cache'
This error occurs when trying to access 'Cache' directly from 'apeye', but it resides in 'apeye.cache'.
fixUse the correct import statement: 'from apeye.cache import Cache'.
ImportError: cannot import name 'RequestsURL' from 'apeye'
This error occurs when attempting to import 'RequestsURL' from 'apeye', but the correct import path is 'apeye.requests_url'.
fixUse the correct import statement: 'from apeye.requests_url import RequestsURL'.
Upgrade
Version history
1.4.1latest on PyPI · released Aug 14, 2023
Audit
Dependencies
cachecontroloptionalRequired for the `apeye.rate_limiter` module functionality.