Skip to main content

Python Oriented Crawling Ongoing (POCONG): a simple crawling framework

Project description

POCONG Logo

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

pocong-1.0.1.tar.gz (26.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pocong-1.0.1-py3-none-any.whl (6.2 kB view details)

Uploaded Python 3

File details

Details for the file pocong-1.0.1.tar.gz.

File metadata

  • Download URL: pocong-1.0.1.tar.gz
  • Upload date:
  • Size: 26.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.13

File hashes

Hashes for pocong-1.0.1.tar.gz
Algorithm Hash digest
SHA256 6f96c4da75c0d482b5b7be9eed7f66a9723b3832c58140d8c43a696d9d047d53
MD5 bc58dd72cb0523e7c9996fdac924df50
BLAKE2b-256 be6e77f1ef7db4d4746efefb1b27c8a9181c20af7b5eb0ad0a15760133599b16

See more details on using hashes here.

File details

Details for the file pocong-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: pocong-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 6.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.13

File hashes

Hashes for pocong-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 36bfb0a8bb77fc65b7dd6ef17ef6058ebc0846f53b878e4ac1040f2829fc51cc
MD5 bcfff2a0a914c1c69eaf8380c357b9fa
BLAKE2b-256 e16cf9a83d39418002c42142efd70737c56984a4e0acc3a73fd243c7063f5d57

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page