Skip to main content

Webscrapper Client API

An asynchronous and synchronous Python client for the Webscrapper API service. This client provides methods for retrieving web pages through proxies and checking URLs against the Russian internet regulator (RKN).

Features

  • Fully asynchronous API built with aiohttp
  • Support for both regular HTTP and Selenium-based web scraping
  • Cookie management for both HTTP and Selenium requests
  • Custom user agent and referer support
  • Mobile and country-specific proxy support
  • RKN checking functionality
  • Context manager support for proper resource management

Installation

pip install webscrapper-client-api

Or install directly from the repository:

pip install git+https://github.com/yourusername/webscrapper-client-api.git

Usage

Basic Example

import asyncio
from webscrapper_client_api import WebscrapperClientAPIAsync

async def main():
    async with WebscrapperClientAPIAsync("your_api_key") as client:
        # Basic page retrieval
        result = await client.get_page(url="https://example.com")
        print(f"Status: {result['status_code']}")
        print(f"Content length: {len(result['html'])}")
        
        # RKN check
        rkn_result = await client.check_rkn(url="https://example.com")
        print(f"RKN check result: {rkn_result}")

if __name__ == "__main__":
    asyncio.run(main())

Using Cookies with Selenium

async with WebscrapperClientAPIAsync("your_api_key") as client:
    # Define cookies for Selenium
    cookies = [
        {"name": "session_id", "value": "abc123"},
        {"name": "user_preferences", "value": "dark_mode=1"}
    ]
    
    # Request with Selenium and cookies
    result = await client.get_page(
        url="https://example.com/login",
        use_selenium=True,
        cookies=cookies
    )

Using Cookies with Regular HTTP

async with WebscrapperClientAPIAsync("your_api_key") as client:
    # Define cookies for HTTP request
    cookies = {
        "session_id": "abc123",
        "user_preferences": "dark_mode=1"
    }
    
    # Request with HTTP and cookies
    result = await client.get_page(
        url="https://example.com/dashboard",
        cookies=cookies,
        user_agent="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36",
        referer="https://example.com/login"
    )

Manual Session Management

async def example():
    # Create client
    client = WebscrapperClientAPIAsync("https://fetch.webnova.one", "your_api_key")
    
    try:
        # Make requests
        result = await client.get_page(url="https://example.com")
    finally:
        # Always close the session when done
        await client.close()

API Methods

get_page

Retrieves a web page through a proxy.

Parameters:

  • url (str): URL to retrieve
  • use_selenium (bool, optional): Use Selenium for request. Default: False
  • use_mobile (bool, optional): Use mobile proxy. Default: False
  • user_agent (str, optional): Custom User-Agent header
  • referer (str, optional): Custom referer (not used for Selenium)
  • method (str, optional): Request method, 'get' or 'head'. Default: 'get'
  • country (int, optional): Proxy country ID
  • cookies (dict or list, optional): Cookies to send with the request

Returns a dictionary with:

  • html: HTML content of the page
  • status_code: HTTP status code
  • url: Final URL (may differ from requested URL after redirects)
  • error: Error message if any
  • selenium: Boolean indicating if Selenium was used (only in Selenium responses)

check_rkn

Checks if a domain is blocked by RKN (Russian internet regulator).

Parameters:

  • url (str): URL to check

Returns a dictionary with the RKN check results.

Exception Handling

The client defines a custom exception WebscrapperAPIError for handling API errors:

try:
    result = await client.get_page(url="https://example.com")
except WebscrapperAPIError as e:
    print(f"API Error: {e.message}, Status code: {e.status_code}")

License

This project is licensed under the WTFPL License.

Metadata

Release files for webscrapper-client-api 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for webscrapper-client-api 0.1.1
File Size Uploaded
webscrapper_client_api-0.1.1.tar.gz 7.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for webscrapper-client-api 0.1.1
File Interpreter ABI Platform
webscrapper_client_api-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 15.0 kB

Release files / webscrapper_client_api-0.1.1.tar.gz

Download URL webscrapper_client_api-0.1.1.tar.gz
Size 7.9 kB
Tags Source
SHA-256 checksum
How to use checksums
956e9a0e0c1b384d09b4532955bb0fd7fcd03c2da15c449dac8d08359fd6c9ff
BLAKE2b-256 checksum
How to use checksums
45b7147248cbaeb2fcbdeebbd61bbf3feb6641a1a848af273161ff6a73e8be03
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.7

Release files / webscrapper_client_api-0.1.1-py3-none-any.whl

Download URL webscrapper_client_api-0.1.1-py3-none-any.whl
Size 7.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a6fde8241e3f563f70f0f6d32995ee8d723f6ed56f50b64ef885b59eaa492345
BLAKE2b-256 checksum
How to use checksums
1e742ba42890c1b71bc582692e6d8c6e96b02f9cc72edd92330d6e6ac7173571
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.7

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page