pyvirtualsms
A small, focused Python library for scraping temporary SMS inboxes. Built for developers who want a clean API, predictable behavior, and zero nonsense.
This started as a personal tool for automating SMS verification flows during scraping. It grew into something reusable, so now it lives here. The goal is simple: provide a lightweight, provider‑agnostic interface for fetching countries, numbers, and messages from virtual SMS services.
Features
- Minimal, readable codebase
- Provider‑agnostic architecture
- Multi-provider support
- Randomized headers to mimic basic browser behavior
- Structured responses for countries, numbers, and messages
- Only depends on requests and selectolax
- Improved error handling and response normalization
- Easy to use '.wait_for_message' method with a timeout and interval
Providers
Installation
pip install pyvirtualsms
Or, if you're working with the repo directly:
pip install -e .
Quick start
from pyvirtualsms import GSMDistributor, Provider
dist = GSMDistributor(Provider.SMS24ME)
# or use 'Provider.RECEIVESMSS'
# or use 'Provider.FREEPHONENUM'
# Get a random number from a random country
phone = dist.get_random_number()
print("Using number:", phone)
# Fetch messages from page 1
messages = dist.get_messages(phone, page=1)
for msg in messages:
print(msg["sender"], ":", msg["text"])
Basic usage
Get available countries
countries = dist.get_countries()
for country in countries:
print(country["name"], "-", country["url"])
Get numbers for a specific country
country = countries[0]
numbers = dist.get_numbers(country=country)
for num in numbers:
print(num["number"], "-", num["url"])
Fetch messages for a number
phone = dist.get_random_number()
messages = dist.get_messages(phone, page=1)
for msg in messages:
print(f"[{msg['sender']}] {msg['text']}")
Project structure
pyvirtualsms/
│
├── client.py # HTTP utilities and headers
├── models.py # TypedDicts and enums
├── distributor.py # High-level public API
│
└── providers/
├── provider_base.py # Abstract provider interface
├── sms24me.py # 'sms24.me' implementation
├── receivesms.py # 'receive-smss.com' implementation
└── freephonenum.py # 'freephonenum.com' implementation
Why this exists
Most temporary SMS tools are either over‑engineered, tied to one provider, or abandoned. This project aims to be simple enough to understand, flexible enough to extend, and stable enough for automation.
Contributing
Open an issue or PR if you'd like to add a provider, fix a bug, or improve parsing.
License
MIT License.
Metadata
Release files for pyvirtualsms 0.4.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pyvirtualsms-0.4.5.tar.gz | 13.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pyvirtualsms-0.4.5-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 31.6 kB
Release files / pyvirtualsms-0.4.5.tar.gz
| Download URL | pyvirtualsms-0.4.5.tar.gz |
|---|---|
| Size | 13.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f60f1479b33f8299e095759b54c8403fe9d5edfabd007ae4eb7d68ae1ecda02a
|
|
BLAKE2b-256 checksum How to use checksums |
7ed22e51261a71dba76d477246d08e6f91ab45f73ec979d8c1dce4a7e08f4456
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Release files / pyvirtualsms-0.4.5-py3-none-any.whl
| Download URL | pyvirtualsms-0.4.5-py3-none-any.whl |
|---|---|
| Size | 17.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1e21a672d9e3c988fdc2f69e6c82de1f7e22376a84b6a6650f9275c8d6c79ee0
|
|
BLAKE2b-256 checksum How to use checksums |
4063e72b92c12b03c23e9a4b2793c117b759bc3926778454f3a9c3c2d32c07a3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|