Skip to main content

Seolyticize for Python

Every Seolyticize API tool (517 in 0.5.3) as a method, and on-site helpers for analytics, IndexNow and deploys. Standard library only, Python 3.9+.

pip install seolyticize

Quick start

from seolyticize import Seolyticize

client = Seolyticize()  # reads SEOLYTICIZE_API_KEY

# Onboard a site: one call returns everything to deploy.
manifest = client.onboard_site(domain="example.com", framework="html")
# …deploy manifest["files"] and the analytics snippet, then:
checklist = client.verify_site(client_id=manifest["clientId"])

# The weekly loop.
for item in client.get_next_steps(client_id=manifest["clientId"])["weekly"]:
    print(item["tool"], item["why"])

Paid research (any domain, the AI answer index, Maps, AI Mode beside rank) takes max_cost_micros. Quote the exact call first:

args = {"clientId": client_id, "target": "rival.com/blog/", "change": "new"}
quote = client.estimate_cost(tool="get_ranked_keywords", arguments=args)
ranked = client.get_ranked_keywords(
    client_id=client_id, target="rival.com/blog/", change="new",
    max_cost_micros=quote["estimatedMaxMicros"],
)

# Free reads over stored data:
pages = client.get_landing_pages(client_id=client_id, tracker_id=tracker_id)
grid = client.get_local_visibility(client_id=client_id, location_id=location_id, term="emergency plumber")
redirects = client.plan_redirect_map(client_id=client_id, old_crawl_id=old_crawl_id, format_="csv")

Arguments are keyword-only and snake_case (client_id, crawl_id); Python keywords get an underscore (from_). Tools newer than this package are reachable with client.call("tool_name", {"camelCase": "input"}). client.list_tools(group="onboarding") lists what your key may call, with schemas.

Errors

from seolyticize import RefusedError, RateLimitError

try:
    client.connect_search_console_service_account(client_id="client_…")
except RefusedError as error:
    print(error.code)        # "search_console_no_access" — branch on this
    print(error.next)        # what to do next
    print(error.request_id)  # quote it when asking for help

ValidationError (400), AuthenticationError (401), PermissionError (403), NotFoundError (404), RefusedError (422), RateLimitError (429), ServerError (5xx), NetworkError — all subclasses of SeolyticizeError. 429s are retried after Retry-After; server and network errors are retried only for read-only tools, since a write that failed may already have happened.

On your site

from seolyticize.site import analytics_tag, indexnow_key_response, notify_deploy, track_event

analytics_tag("SITE_KEY", exclude=["/account/*", "/verify"])  # the <script> for your <head>
body, headers = indexnow_key_response("KEY")                   # serve at /KEY.txt
notify_deploy("https://seolyticize.com/api/v1/hooks/deploy/dh_…")  # after each deploy
track_event("SITE_KEY", "https://example.com/pricing", name="Signup")  # server-side event

Server-side collection

Reports page views from the server — above all the AI assistants (ChatGPT-User, Claude-User, Perplexity-User) that read pages without running the browser tag. Needs the server key from issue_server_collect_key; keep it in the environment.

import os
from seolyticize.collect import ASGICollector, Collector, WSGICollector, django_middleware

collector = Collector("SITE_KEY", os.environ["SEOLYTICIZE_SERVER_KEY"],
                      exclude=["/admin/*", "/api/*"],
                      only="agents")  # with the browser tag installed too; "all" without it

app.wsgi_app = WSGICollector(app.wsgi_app, collector)      # Flask
app = ASGICollector(app, collector)                         # FastAPI / Starlette
SeolyticizeMiddleware = django_middleware(collector)        # Django: add to MIDDLEWARE

Only the path and utm_* parameters (change with allow_params), the referrer's origin, the visitor's address, user agent and country are sent; Seolyticize hashes the address and user agent under a daily salt and stores neither. Bots are dropped before anything is sent. Reports go out on a background thread and never raise.

To credit orders to the visit they came from, send a reference from the checkout — the tag's seolyticize('event', 'Checkout', {ref: cartId}), or collector.track(checkout_url, name="Checkout", props={"ref": cart_id}, user_agent=…, ip=…) with the visitor's own agent and address so it joins their visit — and put the same value in the order's metadata as seolyticize_ref (Stripe metadata, a Shopify cart attribute, Paddle custom_data).

A conversion that happens after the visit — a payment confirmed by webhook, a trial that converts next week — is credited to the visit by its token. Ask for it while the visitor is there and keep it on your server with the account (never in a cookie or the page); the token lasts 35 days:

visit = collector.track_for_visit(request.url, "Signup", user_agent=ua, ip=ip)  # returns the token
account.seolyticize_visit = visit
# ...days later, from the payment webhook:
collector.track_later(account.seolyticize_visit, "Top-up", props={"value": 25})

Docs: seolyticize.com/docs/python-sdk · Agent quick start: seolyticize.com/AGENTS.md

The tool methods are generated from the same registry that runs the API. License: MIT.

Metadata

Release files for seolyticize 0.5.16

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

Source distribution (sdist)

Source distribution for seolyticize 0.5.16
File Size Uploaded Provenance Actions
seolyticize-0.5.16.tar.gz 177.7 kB Without provenance Details for seolyticize-0.5.16.tar.gz

Built distribution (wheel)

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

Total release size: 352.1 kB

Release files / seolyticize-0.5.16.tar.gz

Download URL seolyticize-0.5.16.tar.gz
Size 177.7 kB
Tags Source
SHA-256 checksum
How to use checksums
52e3fef6b6e3b0991101d3747aac2733e9a31704b0b42eb9abe139daeac601b4
BLAKE2b-256 checksum
How to use checksums
2c714fd882bb120aca3ca59e2745b050e085ca7de6e06cac121d409297540e40
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / seolyticize-0.5.16-py3-none-any.whl

Download URL seolyticize-0.5.16-py3-none-any.whl
Size 174.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
37b49477e6bace9b38677c4dfd5d2f127a8aca2011b8cd2e244e10372fe4736a
BLAKE2b-256 checksum
How to use checksums
75451ca901eb729248eeb0a9499dde36fc941b827de9da19c963edfd8368a41b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Security for seolyticize 0.5.16

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.

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