A Python client for fetching public proxies from multiple sources.
Project description
Proxar
Proxar is a Python client for fetching public proxies from various online sources.
It uses an asynchronous architecture to retrieve fresh proxies from multiple providers, providing a stream of proxies for use in web scraping, data analysis, and other network-intensive tasks.
Features
- Multi-Source Aggregation: Fetches and aggregates proxies from a diverse set of public sources, including web pages and APIs.
- Asynchronous Architecture: Built on
asyncioandaiohttpfor high-performance, non-blocking network operations. - Flexible Usage: Choose to have proxies saved directly to a file or returned as a Python dictionary for immediate use.
- Atomic JSON Storage: Safely saves proxies to a single
proxies.jsonfile, preventing data corruption with atomic write operations. - Platform-Aware Storage: Uses
platformdirsto store proxies in the appropriate user-specific data directory, but allows overriding with a custom path. - Persistent Session: Loads previously fetched proxies at startup to maintain a persistently unique and growing list across sessions.
Installation
From PyPI (Recommended)
pip install proxar
From Source
You can set up Proxar by cloning the repository directly.
- Clone the repository:
git clone https://github.com/filming/proxar.git cd proxar
- Install the project and its dependencies:
pip install -e .
- To install development dependencies like
mypyandruff, use:
pip install -e .[dev]
- To install development dependencies like
Usage
Here’s how to use Proxar to fetch proxies. You can either save them to a file or work with them directly.
import asyncio
from proxar import Proxar
async def main():
# Initialize Proxar.
# By default, it uses a platform-specific data directory.
# You can provide a custom path, e.g., Proxar(storage_dir="path/to/proxies")
proxar = Proxar()
try:
# --- Example 1: Save proxies to a file (default behavior) ---
print("Fetching proxies and saving to file...")
await proxar.get_proxies(save_to_file=True)
print("Proxy fetching and saving complete.")
# Proxies are saved in proxies.json inside the storage directory.
# --- Example 2: Get proxies as a dictionary ---
print("\nFetching proxies and returning them directly...")
proxies = await proxar.get_proxies(save_to_file=False)
if proxies:
http_proxies = proxies.get("http", [])
print(f"Fetched {len(http_proxies)} HTTP proxies.")
# print("First 5 HTTP proxies:", http_proxies[:5])
except Exception as e:
print(f"An error occurred: {e}")
if __name__ == "__main__":
asyncio.run(main())
Configuration
Proxar is designed to work out-of-the-box with minimal configuration.
- Storage: By default, Proxar stores fetched proxies in a
proxardirectory inside your user data folder. You can override this by passing astorage_dirargument during initialization. - Logging: The library uses the standard
loggingmodule. You can configure the root logger in your application to control the log level and output format.
Dependencies
All project dependencies are managed via pyproject.toml.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Contributing
Contributions, bug reports, and feature requests are welcome! Please open an issue or submit a pull request on GitHub.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file proxar-0.7.0.tar.gz.
File metadata
- Download URL: proxar-0.7.0.tar.gz
- Upload date:
- Size: 96.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2001a4387f8b0a65a79057f245fe5beb3ac1a53072d5a27be41be02c6c9fb70f
|
|
| MD5 |
aa34b14a5289aab9f83af3b035a0812b
|
|
| BLAKE2b-256 |
899d39f108ab5a9dda2c715a3d9c50f0f664b7701761ef7ab3040b398ac65ff6
|
Provenance
The following attestation bundles were made for proxar-0.7.0.tar.gz:
Publisher:
release.yml on filming/proxar
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
proxar-0.7.0.tar.gz -
Subject digest:
2001a4387f8b0a65a79057f245fe5beb3ac1a53072d5a27be41be02c6c9fb70f - Sigstore transparency entry: 261246475
- Sigstore integration time:
-
Permalink:
filming/proxar@1508c73f59e1f75d5f4cee6616e91730c38d4328 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/filming
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@1508c73f59e1f75d5f4cee6616e91730c38d4328 -
Trigger Event:
push
-
Statement type:
File details
Details for the file proxar-0.7.0-py3-none-any.whl.
File metadata
- Download URL: proxar-0.7.0-py3-none-any.whl
- Upload date:
- Size: 15.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
352a6efc64e075d0e729804860a5fa2ec0c55635b81dd6ab29e3b5e94daec75f
|
|
| MD5 |
10a976535b9f7f1c2c5973c39762c6f0
|
|
| BLAKE2b-256 |
60f99b291dba5ea817f9caff64be31f9ae68f3944b340fda173de1748b75126e
|
Provenance
The following attestation bundles were made for proxar-0.7.0-py3-none-any.whl:
Publisher:
release.yml on filming/proxar
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
proxar-0.7.0-py3-none-any.whl -
Subject digest:
352a6efc64e075d0e729804860a5fa2ec0c55635b81dd6ab29e3b5e94daec75f - Sigstore transparency entry: 261246478
- Sigstore integration time:
-
Permalink:
filming/proxar@1508c73f59e1f75d5f4cee6616e91730c38d4328 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/filming
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@1508c73f59e1f75d5f4cee6616e91730c38d4328 -
Trigger Event:
push
-
Statement type: