Skip to main content

xmlstock

Python client for the XMLStock search engine proxy API. Provides synchronous HTTP access to Yandex XML Proxy, Yandex Live, Google XML Search, and Yandex Wordstat statistics.

PyPI version License: MIT


Features

  • Yandex XML Proxy: Perform automated search queries via official Yandex XML infrastructure.
  • Yandex Live: Real-time SERP extraction for dynamic desktop and mobile positions.
  • Google XML Search: Direct SERP extraction for Google with localization and country filtering.
  • Yandex Wordstat: Keyword frequency, seasonal trends, and regional search volumes.
  • Balance & Limits: Free account checks for funds, active packages, and remaining limits.
  • Clean Sync Client: Synchronous API powered by httpx with context manager support.

Installation

pip install xmlstock

Quick Start

import os
from xmlstock import XmlStockClient

client = XmlStockClient(
    user=os.getenv("XMLSTOCK_USER", "12345"),
    api_key=os.getenv("XMLSTOCK_KEY", "your_api_key"),
)

# Free balance check (does not consume search limits)
balance = client.get_balance()
print("Balance info:", balance)

client.close()

Or using context manager syntax:

with XmlStockClient(user="12345", api_key="your_api_key") as client:
    balance = client.get_balance()
    print("Balance:", balance)

Configuration

Option Type Required Description
user str | int Yes Your XMLStock User ID from dashboard profile.
api_key str Yes Your secret API access key from dashboard.
base_url str No API endpoint base URL. Defaults to https://xmlstock.com.
timeout float No Request timeout in seconds. Defaults to 30.0.

API Reference

get_balance()

Retrieves current account balance, currency, remaining limits, and active packages. This call is free and does not spend search limits.

balance = client.get_balance()
print("Balance:", balance)

search_yandex(query, ...)

Queries Yandex search results via Yandex XML Proxy.

xml = client.search_yandex(
    query="buy laptop",
    lr=213,           # Region: 213 = Moscow, 225 = Russia
    groupby=10,       # Results per page (up to 100)
    page=0,           # Page index (starts at 0)
    domain="ru",      # Domain zone
    filter="moderate",# "none" | "moderate" | "strict"
    device="desktop", # "desktop" | "mobile"
)
print("XML Results:", xml)

search_yandex_live(query, ...)

Queries real-time live search results from Yandex.

xml = client.search_yandex_live(
    query="flights to paris",
    lr=213,
    device="mobile",
)

search_google(query, ...)

Queries Google search results with country and language controls.

xml = client.search_google(
    query="best developer tools",
    domain="com",
    country="us",
    hl="en",
    safe="off",
)

get_wordstat(words, ...)

Retrieves keyword search volumes and related queries from Yandex Wordstat.

stats = client.get_wordstat(
    words=["seo automation", "serp tracker"],
    pagetype="words",  # "words" | "regions" | "dynamics"
)
print("Wordstat data:", stats)

Error Handling

All client methods raise XmlStockError when an API error or network failure occurs.

from xmlstock import XmlStockClient, XmlStockError

try:
    with XmlStockClient(user="12345", api_key="invalid_key") as client:
        xml = client.search_google("query")
except XmlStockError as error:
    print(f"XMLStock Error [{error.code}]: {error.message}")
    print(f"HTTP Status: {error.status}")
    print(f"Response: {error.response_data}")

License

MIT

Metadata

Release files for xmlstock 0.1.0

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

Source distribution (sdist)

Source distribution for xmlstock 0.1.0
File Size Uploaded Provenance
xmlstock-0.1.0.tar.gz 20.5 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for xmlstock 0.1.0
File Interpreter ABI Platform
xmlstock-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 28.1 kB

Release files / xmlstock-0.1.0.tar.gz

Download URL xmlstock-0.1.0.tar.gz
Size 20.5 kB
Tags Source
SHA-256 checksum
How to use checksums
f5dc87de53baf6bca7d3345962a1332e37be2c4a607d4d5626fe8182a23a39a9
BLAKE2b-256 checksum
How to use checksums
8c1e47ac0cb9fb99aa717113e8967a6ae04d0fb40a5e104b398b6b9d610a455e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.6 {"installer":{"name":"uv","version":"0.13.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / xmlstock-0.1.0-py3-none-any.whl

Download URL xmlstock-0.1.0-py3-none-any.whl
Size 7.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
18f2ce8e31da9824759cbc2b5facb5e31ea651bd69478d3549cee9e4febbf42c
BLAKE2b-256 checksum
How to use checksums
b98f052701764328cd3351ef0c1b72e2e65d65163b92b000383b4a2fcbb88592
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.6 {"installer":{"name":"uv","version":"0.13.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for xmlstock 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

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