Name | textverified JSON |
Version |
0.1.0a0
JSON |
| download |
home_page | https://textverified.com |
Summary | Python wrapper for the TextVerified API |
upload_time | 2025-08-01 02:00:37 |
maintainer | None |
docs_url | None |
author | Textverified |
requires_python | None |
license | MIT License Copyright (c) 2025 TextVerified 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. |
keywords |
textverified
verification
web scraping
api
webhook
python
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# TextVerified Python Library
[](https://pypi.python.org/pypi/textverified/)
[](https://github.com/Westbold/PythonClient/issues)
[](https://textverified.readthedocs.io/)
This library eases the use of the TextVerified REST API from Python and provides a comprehensive interface for phone number verification services. It has been designed for production use and includes robust error handling, type hints, and extensive documentation.
## Installation
Download and install using
```
pip install textverified
```
If you're on an older version of python (`<3.11`), install `tomli` first:
```
pip install tomli
```
## Features
- **Complete API Coverage**: All TextVerified endpoints are supported
- **Type Hints**: Full type annotation support for better IDE experience
- **Error Handling**: Comprehensive exception handling with specific error types
- **Dual Usage Patterns**: Support for both instance-based and static usage
- **Pagination**: Automatic handling of paginated results
- **Production Ready**: Robust error handling and retry mechanisms
## Quickstart
### Authentication
You'll need your TextVerified API credentials. You can get these from your TextVerified dashboard.
There are two ways to authenticate:
**Method 1: Environment Variables (Recommended)**
```bash
export TEXTVERIFIED_API_KEY="your_api_key"
export TEXTVERIFIED_API_USERNAME="your_username"
```
Then use the static API:
```python
from textverified import account as tv_account
# Get account details
account_info = tv_account.me()
print("Username:", account_info.username)
print("Balance:", account_info.current_balance)
```
**Method 2: Configure Client Directly**
Set your credentials by calling textverified.configure():
```python
import textverified
textverified.configure(
api_key="your_api_key",
api_username="your_username"
)
```
Then use the static API:
```python
from textverified import account as tv_account
# Get account details
account_info = tv_account.me()
print("Username:", account_info.username)
print("Balance:", account_info.current_balance)
```
**Method 3: Direct Instantiation**
You can create an instance of the client,
this also provides better type hinting.
```python
from textverified import TextVerified
client = TextVerified(
api_key="your_api_key",
api_username="your_username"
)
# Get account details
account_info = client.account.me()
print("Username:", account_info.username)
print("Balance:", account_info.current_balance)
```
## Examples
### Complete Verification Workflow
```python
from textverified import TextVerified, NumberType, ReservationType, ReservationCapability
import time, datetime
# Initialize client
client = TextVerified(api_key="your_api_key", api_username="your_username")
# 1. List available services
services = client.services.list(
number_type=NumberType.MOBILE,
reservation_type=ReservationType.VERIFICATION
)
print(f"Found {len(services)} available services")
for service in services[:5]: # Show first 5
print(f" {service.service_name}")
# 2. Create a verification
verification = client.verifications.create(
service_name="yahoo",
capability=ReservationCapability.SMS
)
print(f"Verification created: {verification.id}")
print(f"Phone number: {verification.number}")
# 3. Do something that sends a message to your number
time.sleep(10)
# 4. Wait for an incoming verification
messages = client.sms.incoming(
verification,
timeout=300,
since=datetime.fromtimestamp(0)
)
for message in messages:
print(f"Received: {message.sms_content}")
```
### Waking Lines
```python
from textverified import reservations, wake_requests, sms, NumberType, ReservationCapability, RentalDuration
import datetime
# 1. Create a wakeable (non-always-on) rental
reservation = reservations.create(
service_name="allservices",
number_type=NumberType.MOBILE,
capability=ReservationCapability.SMS,
is_renewable=False,
always_on=False,
duration=RentalDuration.THIRTY_DAY,
allow_back_order_reservations=False,
).reservations[0]
rental = reservations.details(reservation)
print(f"Reserved number {rental.number} with id {rental.id}")
# 2. Start a wake request for the rental
print("Sending wake request and waiting for active window...")
wake_request = wake_requests.create(rental)
duration = wake_request.usage_window_end - wake_request.usage_window_start
print(
f"Number {rental.number} is active from {wake_request.usage_window_start}"
f" to {wake_request.usage_window_end} (duration: {duration})"
)
# 3. Wait for the wake request to complete
time_until_start = wake_request.usage_window_start - datetime.datetime.now(datetime.timezone.utc)
print(f"Waiting for the number to become active... ({time_until_start})")
wake_response = wake_requests.wait_for_wake_request(wake_request)
# 3. Poll for SMS messages on the awakened number
print(f"Polling SMS messages for number {rental.number}...")
messages = sms.incoming(rental, timeout=duration.total_seconds())
for msg in messages:
print(f"Received SMS from {msg.from_value}: {msg.sms_content}")
```
### Error Handling
```python
from textverified import verifications, TextVerifiedError
try:
verification = verifications.create(
service_name="invalid_service",
capability="SMS"
)
except TextVerifiedError as e:
print(f"TextVerified API Error: {e}")
# Handle specific TextVerified errors
except Exception as e:
print(f"Unexpected error: {e}")
# Handle other exceptions
```
## Documentation
See the [documentation](https://textverified.readthedocs.io/) for full details, including:
- **API Reference**: Complete documentation of all classes and methods
- **Quick Start Guide**: Get up and running quickly
- **Examples**: Real-world usage examples and patterns
- **Error Handling**: Best practices for robust applications
## TextVerified API Reference Links
When working with the TextVerified API, please refer to the official documentation:
1. [TextVerified API Documentation](https://www.textverified.com/docs/api/v2) - Main REST API reference
2. [TextVerified Dashboard](https://www.textverified.com/app/api/configure) - Manage your account and view usage
3. [TextVerified Support](https://www.textverified.com/app/support) - Get help and contact support
## Credits
This library is developed and maintained by **Westbold LLC**.
Special thanks to:
* **TextVerified** for providing a reliable phone verification service and comprehensive API
* **Python Community** for the excellent tools and libraries that make this project possible
* **Our Users** for feedback and contributions that help improve the library
For support, please open a ticket at [TextVerified Support](https://www.textverified.com/app/support)
Raw data
{
"_id": null,
"home_page": "https://textverified.com",
"name": "textverified",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": "Textverified, Verification, Web Scraping, API, webhook, python",
"author": "Textverified",
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/45/8f/edb9876f1470b68e6e1abeb0050e174c1c4e3ab7044322b1f479908181e6/textverified-0.1.0a0.tar.gz",
"platform": null,
"description": "# TextVerified Python Library\r\n\r\n[](https://pypi.python.org/pypi/textverified/)\r\n[](https://github.com/Westbold/PythonClient/issues)\r\n[](https://textverified.readthedocs.io/)\r\n\r\nThis library eases the use of the TextVerified REST API from Python and provides a comprehensive interface for phone number verification services. It has been designed for production use and includes robust error handling, type hints, and extensive documentation.\r\n\r\n\r\n## Installation\r\n\r\nDownload and install using \r\n\r\n```\r\npip install textverified\r\n```\r\n\r\nIf you're on an older version of python (`<3.11`), install `tomli` first:\r\n```\r\npip install tomli\r\n```\r\n\r\n## Features\r\n\r\n- **Complete API Coverage**: All TextVerified endpoints are supported\r\n- **Type Hints**: Full type annotation support for better IDE experience\r\n- **Error Handling**: Comprehensive exception handling with specific error types\r\n- **Dual Usage Patterns**: Support for both instance-based and static usage\r\n- **Pagination**: Automatic handling of paginated results\r\n- **Production Ready**: Robust error handling and retry mechanisms\r\n\r\n\r\n## Quickstart\r\n\r\n### Authentication\r\n\r\nYou'll need your TextVerified API credentials. You can get these from your TextVerified dashboard.\r\n\r\nThere are two ways to authenticate:\r\n\r\n**Method 1: Environment Variables (Recommended)**\r\n\r\n```bash\r\nexport TEXTVERIFIED_API_KEY=\"your_api_key\"\r\nexport TEXTVERIFIED_API_USERNAME=\"your_username\"\r\n```\r\n\r\nThen use the static API:\r\n\r\n```python\r\nfrom textverified import account as tv_account\r\n\r\n# Get account details\r\naccount_info = tv_account.me()\r\nprint(\"Username:\", account_info.username)\r\nprint(\"Balance:\", account_info.current_balance)\r\n```\r\n\r\n**Method 2: Configure Client Directly**\r\n\r\nSet your credentials by calling textverified.configure():\r\n\r\n```python\r\nimport textverified\r\n\r\ntextverified.configure(\r\n api_key=\"your_api_key\",\r\n api_username=\"your_username\"\r\n)\r\n```\r\n\r\nThen use the static API:\r\n\r\n```python\r\nfrom textverified import account as tv_account\r\n\r\n# Get account details\r\naccount_info = tv_account.me()\r\nprint(\"Username:\", account_info.username)\r\nprint(\"Balance:\", account_info.current_balance)\r\n```\r\n\r\n**Method 3: Direct Instantiation**\r\n\r\nYou can create an instance of the client,\r\nthis also provides better type hinting.\r\n\r\n```python\r\nfrom textverified import TextVerified\r\n\r\nclient = TextVerified(\r\n api_key=\"your_api_key\",\r\n api_username=\"your_username\"\r\n)\r\n\r\n# Get account details\r\naccount_info = client.account.me()\r\nprint(\"Username:\", account_info.username)\r\nprint(\"Balance:\", account_info.current_balance)\r\n```\r\n\r\n## Examples\r\n\r\n### Complete Verification Workflow\r\n\r\n```python\r\nfrom textverified import TextVerified, NumberType, ReservationType, ReservationCapability\r\nimport time, datetime\r\n\r\n# Initialize client\r\nclient = TextVerified(api_key=\"your_api_key\", api_username=\"your_username\")\r\n\r\n# 1. List available services\r\nservices = client.services.list(\r\n number_type=NumberType.MOBILE,\r\n reservation_type=ReservationType.VERIFICATION\r\n)\r\n\r\nprint(f\"Found {len(services)} available services\")\r\nfor service in services[:5]: # Show first 5\r\n print(f\" {service.service_name}\")\r\n\r\n# 2. Create a verification\r\nverification = client.verifications.create(\r\n service_name=\"yahoo\",\r\n capability=ReservationCapability.SMS\r\n)\r\n\r\nprint(f\"Verification created: {verification.id}\")\r\nprint(f\"Phone number: {verification.number}\")\r\n\r\n# 3. Do something that sends a message to your number\r\ntime.sleep(10)\r\n\r\n# 4. Wait for an incoming verification\r\nmessages = client.sms.incoming(\r\n verification,\r\n timeout=300,\r\n since=datetime.fromtimestamp(0)\r\n)\r\nfor message in messages:\r\n print(f\"Received: {message.sms_content}\")\r\n```\r\n\r\n### Waking Lines\r\n\r\n```python\r\nfrom textverified import reservations, wake_requests, sms, NumberType, ReservationCapability, RentalDuration\r\nimport datetime\r\n\r\n# 1. Create a wakeable (non-always-on) rental\r\nreservation = reservations.create(\r\n service_name=\"allservices\",\r\n number_type=NumberType.MOBILE,\r\n capability=ReservationCapability.SMS,\r\n is_renewable=False,\r\n always_on=False,\r\n duration=RentalDuration.THIRTY_DAY,\r\n allow_back_order_reservations=False,\r\n).reservations[0]\r\nrental = reservations.details(reservation)\r\nprint(f\"Reserved number {rental.number} with id {rental.id}\")\r\n\r\n# 2. Start a wake request for the rental\r\nprint(\"Sending wake request and waiting for active window...\")\r\nwake_request = wake_requests.create(rental)\r\nduration = wake_request.usage_window_end - wake_request.usage_window_start\r\nprint(\r\n f\"Number {rental.number} is active from {wake_request.usage_window_start}\"\r\n f\" to {wake_request.usage_window_end} (duration: {duration})\"\r\n)\r\n\r\n# 3. Wait for the wake request to complete\r\ntime_until_start = wake_request.usage_window_start - datetime.datetime.now(datetime.timezone.utc)\r\nprint(f\"Waiting for the number to become active... ({time_until_start})\")\r\nwake_response = wake_requests.wait_for_wake_request(wake_request)\r\n\r\n\r\n# 3. Poll for SMS messages on the awakened number\r\nprint(f\"Polling SMS messages for number {rental.number}...\")\r\nmessages = sms.incoming(rental, timeout=duration.total_seconds())\r\nfor msg in messages:\r\n print(f\"Received SMS from {msg.from_value}: {msg.sms_content}\")\r\n```\r\n\r\n### Error Handling\r\n\r\n```python\r\nfrom textverified import verifications, TextVerifiedError\r\n\r\ntry:\r\n verification = verifications.create(\r\n service_name=\"invalid_service\",\r\n capability=\"SMS\"\r\n )\r\nexcept TextVerifiedError as e:\r\n print(f\"TextVerified API Error: {e}\")\r\n # Handle specific TextVerified errors\r\nexcept Exception as e:\r\n print(f\"Unexpected error: {e}\")\r\n # Handle other exceptions\r\n```\r\n\r\n## Documentation\r\n\r\nSee the [documentation](https://textverified.readthedocs.io/) for full details, including:\r\n\r\n- **API Reference**: Complete documentation of all classes and methods \r\n- **Quick Start Guide**: Get up and running quickly\r\n- **Examples**: Real-world usage examples and patterns\r\n- **Error Handling**: Best practices for robust applications\r\n\r\n## TextVerified API Reference Links\r\n\r\nWhen working with the TextVerified API, please refer to the official documentation:\r\n\r\n1. [TextVerified API Documentation](https://www.textverified.com/docs/api/v2) - Main REST API reference\r\n2. [TextVerified Dashboard](https://www.textverified.com/app/api/configure) - Manage your account and view usage\r\n3. [TextVerified Support](https://www.textverified.com/app/support) - Get help and contact support\r\n\r\n## Credits\r\n\r\nThis library is developed and maintained by **Westbold LLC**.\r\n\r\nSpecial thanks to:\r\n\r\n* **TextVerified** for providing a reliable phone verification service and comprehensive API\r\n* **Python Community** for the excellent tools and libraries that make this project possible\r\n* **Our Users** for feedback and contributions that help improve the library\r\n\r\nFor support, please open a ticket at [TextVerified Support](https://www.textverified.com/app/support)\r\n",
"bugtrack_url": null,
"license": "MIT License Copyright (c) 2025 TextVerified 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. ",
"summary": "Python wrapper for the TextVerified API",
"version": "0.1.0a0",
"project_urls": {
"Download": "https://pypi.org",
"Homepage": "https://textverified.com"
},
"split_keywords": [
"textverified",
" verification",
" web scraping",
" api",
" webhook",
" python"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "2f7b57758a612e5062c9d84ed974cd248cf640aa25468cc7d6f3cb0e503449b5",
"md5": "aa5ad6db7ff9d3f652d5765136bf24e3",
"sha256": "26b2f52c9a2138e38c61715e41fb5b3ca905e5d7d783df82029312fff4fd75aa"
},
"downloads": -1,
"filename": "textverified-0.1.0a0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "aa5ad6db7ff9d3f652d5765136bf24e3",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 34605,
"upload_time": "2025-08-01T02:00:36",
"upload_time_iso_8601": "2025-08-01T02:00:36.593642Z",
"url": "https://files.pythonhosted.org/packages/2f/7b/57758a612e5062c9d84ed974cd248cf640aa25468cc7d6f3cb0e503449b5/textverified-0.1.0a0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "458fedb9876f1470b68e6e1abeb0050e174c1c4e3ab7044322b1f479908181e6",
"md5": "cb73e9a85b1b123a3b0eaa26eca6c9b8",
"sha256": "6b9e483be43679c9fdbe6bdeef7cb1229b8659c69643fb23ca48e7fdb5b31624"
},
"downloads": -1,
"filename": "textverified-0.1.0a0.tar.gz",
"has_sig": false,
"md5_digest": "cb73e9a85b1b123a3b0eaa26eca6c9b8",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 69682,
"upload_time": "2025-08-01T02:00:37",
"upload_time_iso_8601": "2025-08-01T02:00:37.686152Z",
"url": "https://files.pythonhosted.org/packages/45/8f/edb9876f1470b68e6e1abeb0050e174c1c4e3ab7044322b1f479908181e6/textverified-0.1.0a0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-08-01 02:00:37",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "textverified"
}