Website to Text is a simple tool for converting a website to text. It returns the text extracted from the website.
Project description
Website to Text API
Website to Text is a simple tool for converting a website to text. It returns the text extracted from the website.
This is a Python API Wrapper for the Website to Text API
Installation
Using pip:
pip install apiverve-websitetotext
Using pip3:
pip3 install apiverve-websitetotext
Configuration
Before using the websitetotext API client, you have to setup your account and obtain your API Key. You can get it by signing up at https://apiverve.com
Quick Start
Here's a simple example to get you started quickly:
from apiverve_websitetotext.apiClient import WebsitetotextAPIClient
# Initialize the client with your APIVerve API key
api = WebsitetotextAPIClient("[YOUR_API_KEY]")
query = { "url": "https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/concepts" }
try:
# Make the API call
result = api.execute(query)
# Print the result
print(result)
except Exception as e:
print(f"Error: {e}")
Usage
The Website to Text API documentation is found here: https://docs.apiverve.com/ref/websitetotext. You can find parameters, example responses, and status codes documented here.
Setup
# Import the client module
from apiverve_websitetotext.apiClient import WebsitetotextAPIClient
# Initialize the client with your APIVerve API key
api = WebsitetotextAPIClient("[YOUR_API_KEY]")
Perform Request
Using the API client, you can perform requests to the API.
Define Query
query = { "url": "https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/concepts" }
Simple Request
# Make a request to the API
result = api.execute(query)
# Print the result
print(result)
Example Response
{
"status": "ok",
"error": null,
"data": {
"date": null,
"description": "Use Amazon EC2 for scalable computing capacity in the AWS Cloud so you can develop and deploy applications without hardware constraints.",
"title": "What is Amazon EC2?",
"title_alt": "What is Amazon EC2?",
"text": "Amazon Elastic Compute Cloud (Amazon EC2) provides on-demand, scalable computing capacity in the Amazon Web \t\tServices (AWS) Cloud. Using Amazon EC2 reduces hardware costs so you can develop and deploy \t\tapplications faster. You can use Amazon EC2 to launch as many or as few virtual servers as you \t\tneed, configure security and networking, and manage storage. You can add capacity (scale up) \t\tto handle compute-heavy tasks, such as monthly or yearly processes, or spikes in website \t\ttraffic. When usage decreases, you can reduce capacity (scale down) again. An EC2 instance is a virtual server in the AWS Cloud. When you launch an EC2 instance, \tthe instance type that you specify determines the hardware available to your instance. \tEach instance type offers a different balance of compute, memory, network, and storage \tresources. For more information, see the Amazon EC2 Instance Types Guide. Amazon EC2 provides the following high-level features: Amazon EC2 supports the processing, storage, and transmission of credit card data by a merchant or service provider, and has been validated as being compliant with Payment Card Industry (PCI) Data Security Standard (DSS). For more information about PCI DSS, including how to request a copy of the AWS PCI Compliance Package, see PCI DSS Level 1. You can create and manage your Amazon EC2 instances using the following interfaces: Amazon EC2 provides the following pricing options: For a complete list of charges and prices for Amazon EC2 and more information about the purchase \t\t\tmodels, see Amazon EC2 pricing. To create estimates for your AWS use cases, use the AWS Pricing Calculator. To estimate the cost of transforming Microsoft workloads to a modern architecture that uses open source and \t\t\t\tcloud-native services deployed on AWS, use the AWS Modernization Calculator for Microsoft Workloads. To see your bill, go to the Billing and Cost Management Dashboard in the AWS Billing and Cost Management console. Your bill contains links to usage reports that provide details \t\t\t\tabout your bill. To learn more about AWS account billing, see AWS Billing and Cost Management User Guide. If you have questions concerning AWS billing, accounts, and events, contact AWS Support. To calculate the cost of a sample provisioned \t\t\t\t\tenvironment, see . When calculating the cost of a provisioned \t\t\t\tenvironment, remember to include incidental costs such as snapshot storage for EBS \t\t\t\tvolumes. You can optimize the cost, security, and performance of your AWS environment \t\t\t\tusing AWS Trusted Advisor. You can use AWS Cost Explorer to analyze the cost and usage of your EC2 instances. You can view \t\t\t\tdata up to the last 13 months, and forecast how much you are likely to spend for the next \t\t\t\t12 months. For more information, see \t\t\t\tAnalyzing your costs and usage with AWS Cost Explorer in the AWS Cost Management User Guide.",
"language": "en",
"publisher": null,
"url": "https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/concepts"
}
}
Error Handling
The API client provides comprehensive error handling through the WebsitetotextAPIClientError exception. Here are some examples:
Basic Error Handling
from apiverve_websitetotext.apiClient import WebsitetotextAPIClient, WebsitetotextAPIClientError
api = WebsitetotextAPIClient("[YOUR_API_KEY]")
query = { "url": "https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/concepts" }
try:
result = api.execute(query)
print("Success!")
print(result)
except WebsitetotextAPIClientError as e:
print(f"API Error: {e.message}")
if e.status_code:
print(f"Status Code: {e.status_code}")
if e.response:
print(f"Response: {e.response}")
Handling Specific Error Types
from apiverve_websitetotext.apiClient import WebsitetotextAPIClient, WebsitetotextAPIClientError
api = WebsitetotextAPIClient("[YOUR_API_KEY]")
query = { "url": "https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/concepts" }
try:
result = api.execute(query)
# Check for successful response
if result.get('status') == 'success':
print("Request successful!")
print(result.get('data'))
else:
print(f"API returned an error: {result.get('error')}")
except WebsitetotextAPIClientError as e:
# Handle API client errors
if e.status_code == 401:
print("Unauthorized: Invalid API key")
elif e.status_code == 429:
print("Rate limit exceeded")
elif e.status_code >= 500:
print("Server error - please try again later")
else:
print(f"API error: {e.message}")
except Exception as e:
# Handle unexpected errors
print(f"Unexpected error: {str(e)}")
Using Context Manager (Recommended)
The client supports the context manager protocol for automatic resource cleanup:
from apiverve_websitetotext.apiClient import WebsitetotextAPIClient, WebsitetotextAPIClientError
query = { "url": "https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/concepts" }
# Using context manager ensures proper cleanup
with WebsitetotextAPIClient("[YOUR_API_KEY]") as api:
try:
result = api.execute(query)
print(result)
except WebsitetotextAPIClientError as e:
print(f"Error: {e.message}")
# Session is automatically closed here
Advanced Features
Debug Mode
Enable debug logging to see detailed request and response information:
from apiverve_websitetotext.apiClient import WebsitetotextAPIClient
# Enable debug mode
api = WebsitetotextAPIClient("[YOUR_API_KEY]", debug=True)
query = { "url": "https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/concepts" }
# Debug information will be printed to console
result = api.execute(query)
Manual Session Management
If you need to manually manage the session lifecycle:
from apiverve_websitetotext.apiClient import WebsitetotextAPIClient
api = WebsitetotextAPIClient("[YOUR_API_KEY]")
query = { "url": "https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/concepts" }
try:
result = api.execute(query)
print(result)
finally:
# Manually close the session when done
api.close()
Customer Support
Need any assistance? Get in touch with Customer Support.
Updates
Stay up to date by following @apiverveHQ on Twitter.
Legal
All usage of the APIVerve website, API, and services is subject to the APIVerve Terms of Service and all legal documents and agreements.
License
Licensed under the The MIT License (MIT)
Copyright (©) 2026 APIVerve, and EvlarSoft LLC
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
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
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 apiverve_websitetotext-1.1.14.tar.gz.
File metadata
- Download URL: apiverve_websitetotext-1.1.14.tar.gz
- Upload date:
- Size: 13.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8b5d62be3b3e43ec48421f3027471018d14789567ccab6f624e304d4707e5686
|
|
| MD5 |
1006336488dc445b3100d3e34da242bc
|
|
| BLAKE2b-256 |
07873eb2e5fdd8147ffe71ffdaec7ffd550fb2834e55c83f353adb3c5233ab48
|
File details
Details for the file apiverve_websitetotext-1.1.14-py3-none-any.whl.
File metadata
- Download URL: apiverve_websitetotext-1.1.14-py3-none-any.whl
- Upload date:
- Size: 11.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ea14c25c80142212a93387ffce02de026f5c898b617392c855bfbbc42fd80d02
|
|
| MD5 |
dfa2c05a4b55781476ea42af9ac0b107
|
|
| BLAKE2b-256 |
2e3a805a89cd4cdfa99adca1cb43bc53a573e35ac53baa1e617d32c402b7974b
|