A lightweight Python library for scraping temporary SMS inboxes from multiple providers.
Project description
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
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'
# 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
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.
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 pyvirtualsms-0.2.1.tar.gz.
File metadata
- Download URL: pyvirtualsms-0.2.1.tar.gz
- Upload date:
- Size: 12.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5aa12459175c2b6de123c910dc862d5d062532093f30a624682ffe177a023064
|
|
| MD5 |
d0d657f9ce8ccc52e08b212b1f993828
|
|
| BLAKE2b-256 |
89eecf56cd5e683cec671200d2e6d45c0dd541026e6d4fd39495ae87d593d574
|
File details
Details for the file pyvirtualsms-0.2.1-py3-none-any.whl.
File metadata
- Download URL: pyvirtualsms-0.2.1-py3-none-any.whl
- Upload date:
- Size: 14.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0bb427e36b8c26e2c1d1086b7c54d0233db0aebce1a72579725567d0552253d5
|
|
| MD5 |
e2ea461a2e3f455e5c2441b08be49720
|
|
| BLAKE2b-256 |
28e5e067c8ac3f3b054f19ddd24d6672008ec84a98974b03b4f03e60fa21c866
|