Official Python SDK for ToolCenter's web automation and utility APIs
Project description
ToolCenter Python SDK
Official Python SDK for ToolCenter's web automation and utility APIs. Take screenshots, generate PDFs, create QR codes, extract metadata, and access 20+ other web-related tools through a simple Python interface.
Installation
pip install toolcenter
Quick Start
from toolcenter import ToolCenter
# Initialize client with your API key
tc = ToolCenter('your-api-key')
# Take a screenshot
result = tc.screenshot(url='https://example.com', width=1920, format='png')
# Generate a PDF
pdf_result = tc.pdf(url='https://example.com', format='A4')
# Create a QR code
qr_result = tc.qr(data='https://example.com', size=300)
Authentication
Get your API key from ToolCenter Dashboard and initialize the client:
from toolcenter import ToolCenter
tc = ToolCenter('your-api-key')
# Or with custom base URL
tc = ToolCenter('your-api-key', base_url='https://api.toolcenter.dev')
Core Features
Screenshots
Capture high-quality webpage screenshots:
# Basic screenshot
result = tc.screenshot(url='https://example.com')
# Full page screenshot with custom dimensions
result = tc.screenshot(
url='https://example.com',
width=1920,
height=1080,
full_page=True,
format='png'
)
# Mobile device emulation
result = tc.screenshot(
url='https://example.com',
device='iPhone 12',
wait_for='#content'
)
PDF Generation
Convert webpages to PDF documents:
# Basic PDF
result = tc.pdf(url='https://example.com')
# Custom format and options
result = tc.pdf(
url='https://example.com',
format='A4',
landscape=True,
print_background=True,
margin={'top': '1in', 'bottom': '1in'}
)
QR Codes
Generate QR codes for any data:
# Basic QR code
result = tc.qr(data='https://example.com')
# Custom size and format
result = tc.qr(
data='Hello World!',
size=500,
format='svg',
error_correction='H'
)
Metadata Extraction
Extract rich metadata from websites:
# Extract all metadata
result = tc.metadata(url='https://example.com')
# Include specific data types
result = tc.metadata(
url='https://example.com',
include_og=True,
include_twitter=True,
include_schema=True
)
Available Methods
Web Content
screenshot(**kwargs)- Capture webpage screenshotspdf(**kwargs)- Generate PDFs from webpageshtml_to_image(**kwargs)- Convert HTML to imagemetadata(**kwargs)- Extract webpage metadataog_image(**kwargs)- Get Open Graph imageslink_preview(**kwargs)- Generate rich link previewsfavicon(**kwargs)- Extract website favicons
Image Processing
watermark(**kwargs)- Add watermarks to imagescompress(**kwargs)- Compress and optimize imagescolors(**kwargs)- Extract dominant colorsplaceholder(**kwargs)- Generate placeholder images
Utilities
qr(**kwargs)- Generate QR codesstatus(**kwargs)- Check website statusdns(**kwargs)- Perform DNS lookupsssl(**kwargs)- Check SSL certificateswhois(**kwargs)- WHOIS domain lookupstech_stack(**kwargs)- Detect website technologies
Bulk Operations
bulk_screenshot(urls, **kwargs)- Screenshot multiple URLsbulk_pdf(urls, **kwargs)- Generate PDFs for multiple URLsbulk_metadata(urls, **kwargs)- Extract metadata from multiple URLs
Account
usage()- Get API usage statistics
Error Handling
The SDK includes custom exception classes for different error types:
from toolcenter import ToolCenter, ToolCenterError, AuthenticationError, RateLimitError
tc = ToolCenter('your-api-key')
try:
result = tc.screenshot(url='https://example.com')
except AuthenticationError:
print("Invalid API key")
except RateLimitError:
print("Rate limit exceeded")
except ToolCenterError as e:
print(f"API error: {e}")
Bulk Operations
Process multiple URLs efficiently:
# Screenshot multiple websites
urls = [
'https://example.com',
'https://github.com',
'https://stackoverflow.com'
]
results = tc.bulk_screenshot(urls, width=1920, format='png')
for url, result in results.items():
if result['success']:
print(f"Screenshot saved for {url}")
else:
print(f"Error for {url}: {result['error']}")
Advanced Usage
Custom Configuration
# Custom timeout and retry settings
tc = ToolCenter(
api_key='your-api-key',
base_url='https://toolcenter.dev'
)
# Screenshot with advanced options
result = tc.screenshot(
url='https://example.com',
width=1920,
height=1080,
full_page=False,
wait_for='#main-content',
delay=2000, # 2 second delay
device='Desktop'
)
Response Format
All methods return a dictionary with the following structure:
{
"success": True,
"data": {
"url": "https://generated-content-url.com/image.png",
"size": 156789,
"format": "png",
"width": 1920,
"height": 1080
},
"usage": {
"credits_used": 1,
"remaining": 999
}
}
Requirements
- Python 3.8+
- requests >= 2.20.0
Documentation
For complete API documentation and advanced usage examples, visit:
Support
- Issues: GitHub Issues
- Email: hello@toolcenter.dev
- Documentation: https://toolcenter.dev/docs
License
This project is licensed under the MIT License - see the LICENSE file for details.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Made with ❤️ by ToolCenter
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 toolcenter-1.1.0.tar.gz.
File metadata
- Download URL: toolcenter-1.1.0.tar.gz
- Upload date:
- Size: 12.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cdb88cdac82148193ac30989a10a0e350d0c464c13afdd65de9aa86e298760a4
|
|
| MD5 |
9ff35ce2c5030c510bd17c67f53dd254
|
|
| BLAKE2b-256 |
677a7a12384ee2604637cb799df54cc02b8748a4076d22715d9368756f901f39
|
Provenance
The following attestation bundles were made for toolcenter-1.1.0.tar.gz:
Publisher:
publish.yml on toolcenter-dev/sdk-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
toolcenter-1.1.0.tar.gz -
Subject digest:
cdb88cdac82148193ac30989a10a0e350d0c464c13afdd65de9aa86e298760a4 - Sigstore transparency entry: 992451410
- Sigstore integration time:
-
Permalink:
toolcenter-dev/sdk-python@1d1af065a929df6ab0e26688c5777bf545241b05 -
Branch / Tag:
refs/tags/v1.1.0 - Owner: https://github.com/toolcenter-dev
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@1d1af065a929df6ab0e26688c5777bf545241b05 -
Trigger Event:
push
-
Statement type:
File details
Details for the file toolcenter-1.1.0-py3-none-any.whl.
File metadata
- Download URL: toolcenter-1.1.0-py3-none-any.whl
- Upload date:
- Size: 10.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2687ec872eaf76e24d02071fc704e4d86388081748c488a5c1ce2ae28ba5a0f2
|
|
| MD5 |
3cfc467f09757ddf22c7104801a7c6ae
|
|
| BLAKE2b-256 |
6760d94eaaa134e171afd323fa33c962252adf065031bfda78bdbcdcea1a328d
|
Provenance
The following attestation bundles were made for toolcenter-1.1.0-py3-none-any.whl:
Publisher:
publish.yml on toolcenter-dev/sdk-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
toolcenter-1.1.0-py3-none-any.whl -
Subject digest:
2687ec872eaf76e24d02071fc704e4d86388081748c488a5c1ce2ae28ba5a0f2 - Sigstore transparency entry: 992451413
- Sigstore integration time:
-
Permalink:
toolcenter-dev/sdk-python@1d1af065a929df6ab0e26688c5777bf545241b05 -
Branch / Tag:
refs/tags/v1.1.0 - Owner: https://github.com/toolcenter-dev
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@1d1af065a929df6ab0e26688c5777bf545241b05 -
Trigger Event:
push
-
Statement type: