Python Oriented Crawling Ongoing (POCONG): a simple crawling framework
Project description
POCONG 🪦
Python Oriented Crawling ON Going
POCONG is a lightweight web crawling framework built in Python.
Installation
pip install pocong
Usage: Get Proxy from proxy_spiders
You can use the get_proxy and get_proxy_random methods from proxy_spiders to fetch working proxies.
from pocong.proxy_spiders import GetProxy
gp = GetProxy()
# Get the first working proxy
proxy = gp.get_proxy()
print("First working proxy:", proxy)
from pocong.proxy_spiders import GetProxy
gp = GetProxy()
# Get a random working proxy
random_proxy = gp.get_proxy_random()
print("Random working proxy:", random_proxy)
Sample output:
First working proxy: {'ip': '123.45.67.89', 'port': '8080', 'https': 'yes', ...}
Random working proxy: {'ip': '98.76.54.32', 'port': '3128', 'https': 'yes', ...}
You can use the returned proxy dictionary with the requests library, for example:
import requests
proxy = gp.get_proxy()
if proxy:
proxies = {
'http': f"http://{proxy['ip']}:{proxy['port']}",
'https': f"http://{proxy['ip']}:{proxy['port']}"
}
response = requests.get('https://httpbin.org/ip', proxies=proxies)
print(response.json())
else:
print("No working proxy found.")
get_proxy()will return the first working proxy found.get_proxy_random()will return a random working proxy (with up to 20 retries).
Both methods return a dictionary with proxy details (e.g., { 'ip': '...', 'port': '...', ... }) or None if no working proxy is found.
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 pocong-1.0.0.tar.gz.
File metadata
- Download URL: pocong-1.0.0.tar.gz
- Upload date:
- Size: 26.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5eae3b45c19737341a937c95e3d2eb680671eea5ca1c3d7db3e8091706a5ab15
|
|
| MD5 |
5f1649bec742717b404de978336c5d95
|
|
| BLAKE2b-256 |
d0adf067e4c056b68b93ac030849f932732441cc7b492cf865324b973384159d
|
File details
Details for the file pocong-1.0.0-py3-none-any.whl.
File metadata
- Download URL: pocong-1.0.0-py3-none-any.whl
- Upload date:
- Size: 6.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
796b2c2163b332d45449d37df0564b010c31be917be7c3169fcd04b9ddd8cf4c
|
|
| MD5 |
5b5460d7bcf46de90dfa48e62021d0fe
|
|
| BLAKE2b-256 |
eb3e7c0740ab38d3c4ca514e7bb8818df7c529c8098b6feb2ad3756c79278de9
|