Documentation has been updated: see help center and changelog in one place.

Python SDK

Learn how to use the AI Studio Python SDK.

YouTube

We offer a simple Python SDK for seamlessly interacting with Oxylabs AI Studio API services, including AI-Scraper, AI-Crawler, AI-Browser-Agent, and other data extraction tools.

Requirements

  • python 3.10 and above

  • AI Studio API key

Installation

Usage

Crawl (AiCrawler.crawl)

Input parameters

  • url (str): Starting URL to crawl (required)

  • user_prompt (str): Natural language prompt to guide extraction (required)

  • output_format (Literal["json", "markdown"]): Output format (default: "markdown")

  • schema (dict | None): OpenAPI schema for structured extraction (required if output_format is "json")

  • render_javascript (bool): Render JavaScript (default: False)

  • return_sources_limit (int): Max number of sources to return (default: 25)

  • geo_location (str): proxy location in ISO2 format.

Scrape (AiScraper.scrape)

Input parameters

  • url (str): Target URL to scrape (required)

  • output_format (Literal["json", "markdown"]): Output format (default: "markdown")

  • schema (dict | None): OpenAPI schema for structured extraction (required if output_format is "json")

  • render_javascript (bool): Render JavaScript (default: False)

  • geo_location (str): proxy location in ISO2 format.

Browser Agent (BrowserAgent.run)

Input parameters

  • url (str): Starting URL to browse (required)

  • user_prompt (str): Natural language prompt for extraction (required)

  • output_format (Literal["json", "markdown", "html", "screenshot"]): Output format (default: "markdown")

  • schema (dict | None): OpenAPI schema for structured extraction (required if output_format is "json")

  • geo_location (str): proxy location in ISO2 format.

Search (AiSearch.search)

Input parameters

  • query (str): What to search for (required)

  • limit (int): Maximum number of results to return (default: 10, maximum: 50)

  • render_javascript (bool): Render JavaScript (default: False)

  • return_content (bool): Whether to return markdown contents in results (default: True)

  • geo_location (str): search proxy location in ISO2 format.

Map (AiMap.map)

Input parameters

  • url (str): Starting URL to crawl (required)

  • user_prompt (str): Natural language prompt to guide extraction (required)

  • render_javascript (bool): Render JavaScript (default: False)

  • return_sources_limit (int): Max number of sources to return (default: 25)

  • geo_location (str): proxy location in ISO2 format.

Usage examples

See the examples folder for usage examples of each method.

Each method has a corresponding async version.

Last updated

Was this helpful?