Skip to main content

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'
# 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.

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

pyvirtualsms-0.3.3.tar.gz (12.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyvirtualsms-0.3.3-py3-none-any.whl (16.4 kB view details)

Uploaded Python 3

File details

Details for the file pyvirtualsms-0.3.3.tar.gz.

File metadata

  • Download URL: pyvirtualsms-0.3.3.tar.gz
  • Upload date:
  • Size: 12.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for pyvirtualsms-0.3.3.tar.gz
Algorithm Hash digest
SHA256 f745711a09ab6c004e7c6004887ba80cbf7b1104fe3ef06d9b5b3ce10604aa3c
MD5 521d8e0297a1eb22bf92ee818d128ddc
BLAKE2b-256 0149b003c15e9f9850b928bafe63f0c83661710273f28b7788f8514491f18534

See more details on using hashes here.

File details

Details for the file pyvirtualsms-0.3.3-py3-none-any.whl.

File metadata

  • Download URL: pyvirtualsms-0.3.3-py3-none-any.whl
  • Upload date:
  • Size: 16.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for pyvirtualsms-0.3.3-py3-none-any.whl
Algorithm Hash digest
SHA256 a0fe3f8aa6ac69b4d2f1c4842baedf6e1180c1054358ed70a443ff6053c0f341
MD5 99832866834c795ff837e730d1c49676
BLAKE2b-256 d89803acc9ca3f5cf3bbdb0055c679bdc4e5c98aaf585ba44f5c8eefc8e89265

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page