Registry / http-networking / apeye
library1.4.1pypypi✓ verified 22d ago

apeye is a Python library providing handy tools for working with URLs and APIs. It offers `pathlib.Path`-like objects for robust URL manipulation, a JSON-backed cache decorator for functions, and a `CacheControl` adapter for rate limiting HTTP requests. The library is currently at version 1.4.1 and maintains a sporadic but active release cadence.

pip install apeye
INSTALL
IMPORT
SIG · APEYE
A
apeye
http-networkingpythonv1.4.1
Install
2.6s avg
Import
111ms
Disk
24MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
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
musl
py 3.103.910 runs
installs and imports cleanly · install 0.0s · import 0.115s · 25.5MB
glibc
py 3.103.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
Debug
Known issues
breakingWhen using the `rate_limiter` module, specifically `RateLimitAdapter`, ensure you install `apeye` with the `[limiter]` extra. As of v0.9.0, this functionality was moved to an optional dependency.
fix
Install `apeye` using `pip install apeye[limiter]` to include the necessary dependencies for rate limiting.
affects: >=0.9.0
gotchaThe primary `apeye.url.URL` class provides `pathlib.Path`-like functionality for URL manipulation but does not directly integrate with the `requests` library. For `requests` integration, use `apeye.requests_url.RequestsURL` or explicitly convert the `URL` object to a string before passing it to `requests`.
fix
If you intend to use `apeye` URLs with `requests`, import and use `RequestsURL` (e.g., `RequestsURL('your_url').get_url()`) or convert a `URL` object to a string explicitly: `requests.get(str(my_url))`.
affects: All versions
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'apeye'
This error occurs when the 'apeye' package is not installed in your Python environment.
fix
Install 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'.
fix
Use 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'.
fix
Install 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'.
fix
Use 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'.
fix
Use 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.
Agent activity
32 hits · last 30 days
node
28
OpenAI (training)
1
Resources
apeye — pip install apeye · libregistry