A client library for interacting with the ImportIO API
Project description
ImportIO Client
A Python client library for interacting with the ImportIO API. This client provides an easy-to-use interface for managing extractors and crawl runs.
Installation
You can install the ImportIO Client using pip:
pip install importio-client
Usage
Here's a quick start guide to using the ImportIO Client:
from importio_client import ImportIOClient
# Initialize the client
client = ImportIOClient(api_key="your_api_key_here")
# Working with extractors
extractor_id = "your_extractor_id"
# Set inputs for an extractor
client.extractor.set_inputs(extractor_id, "https://example.com")
# Set inputs with default attributes
client.extractor.set_inputs(
extractor_id,
["https://example.com", "https://another.com"],
default_attributes={"Max Screens": 50, "Browser": "chrome"}
)
# Start a run
run_info = client.extractor.start_run(extractor_id)
print(run_info)
# Get extractor history
history = client.extractor.get_history(extractor_id)
print(history)
# Working with crawl runs
crawl_run_id = "your_crawl_run_id"
# Get crawl run information
crawl_info = client.crawl_run.get_info(crawl_run_id)
print(crawl_info)
# Get a file from a crawl run
from importio_client import FileType
file_content = client.crawl_run.get_file(crawl_run_id, FileType.CSV)
Features
- Easy-to-use interface for ImportIO API
- Support for extractor operations (set inputs, start/stop runs, get history)
- Support for crawl run operations (get info, retrieve files)
- Flexible input handling for extractors, including support for default attributes
- Built-in error handling and response parsing
API Reference
ImportIOClient
The main client class for interacting with the ImportIO API.
Methods:
__init__(api_key: str): Initialize the client with your API key.
ExtractorEndpoint
Accessible via client.extractor.
Methods:
set_inputs(extractor_id: str, inputs: Union[str, List[str], Dict[str, Any], List[Dict[str, Any]]], default_attributes: Dict[str, Any] = None) -> Dict[str, Any]: Set inputs for an extractor.get_inputs(extractor_id: str) -> List[Dict[str, Any]]: Get current inputs for an extractor.get_history(extractor_id: str) -> Dict[str, Any]: Get run history for an extractor.start_run(extractor_id: str) -> Dict[str, Any]: Start a new run for an extractor.stop_run(extractor_id: str) -> Dict[str, Any]: Stop the current run for an extractor.
CrawlRunEndpoint
Accessible via client.crawl_run.
Methods:
get_info(crawl_run_id: str) -> Dict[str, Any]: Get information about a specific crawl run.get_file(crawl_run_id: str, file_type: FileType) -> bytes: Get a specific file type for a crawl run.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file importio_client-0.2.1.tar.gz.
File metadata
- Download URL: importio_client-0.2.1.tar.gz
- Upload date:
- Size: 6.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fff99370102c11d8f61f1b816351cf07071979ac6737a0b75c72a1671e8b20d5
|
|
| MD5 |
b81f90aaea2bf6e14eeb2f34729b92af
|
|
| BLAKE2b-256 |
bcdb4bddc329abe68f025bdaa689228b57cc64a08998e1f29a7e3e47b1d46eab
|
File details
Details for the file importio_client-0.2.1-py3-none-any.whl.
File metadata
- Download URL: importio_client-0.2.1-py3-none-any.whl
- Upload date:
- Size: 6.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2c709f0ac8bcc97b595db89b55f9992f1e1f87244f291da1dbb6de6e9dca7af3
|
|
| MD5 |
25214788344bd416d2c14e9bc2a98982
|
|
| BLAKE2b-256 |
8267a8ef7f5fb1ceb04685b6c55138ce5b0cd75e1e6056b3e08090e66df014d2
|