Skip to main content

Python client for the Octivas web scraping and extraction API

Project description

Octivas Python SDK

The official Python client for the Octivas web scraping and extraction API.

Installation

pip install octivas

Quick start

from octivas import Octivas

client = Octivas(api_key="oc-...")

# Scrape a single page
result = client.scrape("https://docs.octivas.com")
print(result.markdown)

# Crawl a website
crawl = client.crawl("https://docs.octivas.com", limit=20)
for page in crawl.pages:
    print(page.url, page.metadata.title)

# Search the web
search = client.search("python web scraping", limit=5)
for item in search.results:
    print(item.title, item.url)

Async usage

from octivas import AsyncOctivas

async with AsyncOctivas(api_key="oc-...") as client:
    result = await client.scrape("https://docs.octivas.com")
    print(result.markdown)

Batch scraping

client = Octivas(api_key="oc-...")

job = client.batch_scrape(["https://docs.octivas.com", "https://octivas.com"])
status = client.batch_scrape_wait(job.job_id)

for result in status.results:
    print(result.url, len(result.markdown or ""))

Error handling

from octivas import Octivas, AuthenticationError, RateLimitError

client = Octivas(api_key="oc-...")

try:
    result = client.scrape("https://docs.octivas.com")
except AuthenticationError:
    print("Invalid API key")
except RateLimitError:
    print("Too many requests - back off and retry")

Configuration

client = Octivas(
    api_key="oc-...",
    base_url="https://api.octivas.com",  # default
    timeout=60.0,                         # seconds
)

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

octivas-0.1.0.tar.gz (5.8 kB view details)

Uploaded Source

Built Distribution

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

octivas-0.1.0-py3-none-any.whl (6.6 kB view details)

Uploaded Python 3

File details

Details for the file octivas-0.1.0.tar.gz.

File metadata

  • Download URL: octivas-0.1.0.tar.gz
  • Upload date:
  • Size: 5.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for octivas-0.1.0.tar.gz
Algorithm Hash digest
SHA256 5376dad112f137d1ed426e297dfcfb13af0d505ad9c2d9fde27530faea88c76c
MD5 1737ea42f687bb9751b7a81862fbbb29
BLAKE2b-256 7156d0b2dc1549089a825b344e86f775d97b055f2fd25d97207e6fd244f7d64d

See more details on using hashes here.

File details

Details for the file octivas-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: octivas-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 6.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for octivas-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 50af1b7599536b48f1fa8d871e524a228a459726c782708df128333a4b8f60fb
MD5 6ea1b563fa0dd58a050eb7321a0ebd8f
BLAKE2b-256 3e1ba41eac9a3f0521d85f9fe0e0259b355e5ad9ebbe8a2682f7cf4904f7d54a

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