Skip to main content
The official Python library makes it easy to integrate Spoo.me’s URL shortening service into your Python applications.

Installation

Install the library using pip:

Quick Start

Here’s a simple example to get you started:

Features

URL Shortening

Shorten URLs with custom aliases and settings

Statistics

Get detailed analytics for your shortened URLs

Data Export

Export your URL data in various formats

Rate Limiting

Built-in rate limiting to respect API limits

Usage Examples

Basic URL Shortening

Advanced URL Shortening

URL Statistics

Data Export

Error Handling

API Reference

Shortener Class

shorten()

Shortens a URL with optional parameters. Returns a shortened URL string.
string
required
The URL to shorten. Must be a valid HTTP or HTTPS URL.
string
Custom alias for the shortened URL. If not provided, a random short code will be generated.
string
Password protection for the shortened URL. Users will need to enter this password to access the original URL.
integer
Maximum number of clicks allowed for this shortened URL. Once reached, the URL will become inactive.
boolean
Whether to block bots from accessing the shortened URL. Default is false.

emoji_shorten()

Creates emoji-based shortened URLs. Returns a shortened URL string with emojis.
string
required
The URL to shorten. Must be a valid HTTP or HTTPS URL.
string
Custom emoji sequence for the shortened URL. If not provided, random emojis will be used.
string
Password protection for the shortened URL. Users will need to enter this password to access the original URL.
integer
Maximum number of clicks allowed for this shortened URL. Once reached, the URL will become inactive.
boolean
Whether to block bots from accessing the shortened URL. Default is false.

Statistics Class

get_stats()

Retrieves statistics for a shortened URL. Returns a dictionary containing detailed statistics.
string
required
The short code of the URL for which to retrieve statistics.
string
Password if the URL is protected. Required only for password-protected URLs.

DataExport Class

export_data()

Exports URL data in various formats. Returns raw data in the specified format.
string
required
The short code of the URL for which to export data.
string
required
Export format. Supported formats: "json", "csv", "xlsx", "xml".
string
Password if the URL is protected. Required only for password-protected URLs.

Configuration

Custom Base URL

Rate Limiting Configuration

Error Types

The library provides specific error types for different scenarios:
Base exception class for all Spoo.me related errors.Attributes:
  • error_type: The type of error (e.g., “UrlError”, “AliasError”)
  • message: Detailed error message
  • status_code: HTTP status code
Raised when the provided URL is invalid or missing.
Raised when the requested alias is invalid or already taken.
Raised when the password doesn’t meet requirements.
Raised when API rate limits are exceeded.

Complete Documentation

For comprehensive documentation, code examples, and advanced usage patterns, visit the complete library documentation:

View Complete Documentation

Access detailed documentation, API reference, and advanced examples

Contributing

The library is open source and welcomes contributions:

GitHub Repository

Contribute to the project, report issues, or suggest improvements

Support

If you encounter any issues with the Python library:

GitHub Issues

Report bugs or request features

Discord Support

Get help from the community