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.3.tar.gz (8.7 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.3-py3-none-any.whl (8.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: octivas-0.1.3.tar.gz
  • Upload date:
  • Size: 8.7 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.3.tar.gz
Algorithm Hash digest
SHA256 bb91845d260d19bb0aed3d577cd7cdde1b70de41c3144ae7be158a6ca3cb0d57
MD5 8196911cf0e5e59a9e776dee6f97dad5
BLAKE2b-256 33384f0c19a6801ef6520099c3985b428721205d1194bee29522aaacde58a125

See more details on using hashes here.

File details

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

File metadata

  • Download URL: octivas-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 8.0 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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 b3fbb874c95cea1d54fb3d8b68b2f03b3e3a18a65d1ce29a76f4be3026fc0051
MD5 97dcb250fd00a8cedc2c222b68581665
BLAKE2b-256 22ade883592db18e297ccbeee64bbf54d7298cf7d76a6f776ddaa1e74cbcd695

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