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.1.tar.gz (7.0 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.1-py3-none-any.whl (6.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: octivas-0.1.1.tar.gz
  • Upload date:
  • Size: 7.0 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.1.tar.gz
Algorithm Hash digest
SHA256 1b9761fb772f6f4777d545aa5aa100a411c454bc3cb9c5f8543c6e3aaed06a25
MD5 4a3e502d387fb2ad588e6f195bbbfc6e
BLAKE2b-256 f77a351b0272d29ff35f880d3b8b7327569af6cbcff30f7d93e998032f488219

See more details on using hashes here.

File details

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

File metadata

  • Download URL: octivas-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 6.9 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 216ffc2d2d9adcf77aabaefbf12ec5387e56668a203834f6d6b25d92535d614a
MD5 ab6b99efff3f70b3f14750bcd42321f5
BLAKE2b-256 7a01ffd4df9d7659d98ed8fdccccaa2161ea78056e1eb12c0a1cb1264e0fec66

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