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

Uploaded Python 3

File details

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

File metadata

  • Download URL: octivas-0.1.2.tar.gz
  • Upload date:
  • Size: 7.3 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.2.tar.gz
Algorithm Hash digest
SHA256 2526005689fcb5f65b7af450d8c76242886031681069e0fdbea54d33a9b74010
MD5 57856c245bac977c6ae450ea5a0483f7
BLAKE2b-256 32b503628c22b4acb5c85868f3cd43be3d8f565c5a76c1ad3976ddd278ccb240

See more details on using hashes here.

File details

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

File metadata

  • Download URL: octivas-0.1.2-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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 966108bce12b83ee2e97dda50771b0c099ccae3c3ca73c9403d58ede4263f1f1
MD5 fa79a69cc31dff5186c5bcdf909764f0
BLAKE2b-256 7e182e7e256d20d36ab34f1240efa47058b240955c15be1dbeae2d5956bebe21

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