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.
The URL to shorten. Must be a valid HTTP or HTTPS URL.
Custom alias for the shortened URL. If not provided, a random short code will be generated.
Password protection for the shortened URL. Users will need to enter this password to access the original URL.
Maximum number of clicks allowed for this shortened URL. Once reached, the URL will become inactive.
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.
The URL to shorten. Must be a valid HTTP or HTTPS URL.
Custom emoji sequence for the shortened URL. If not provided, random emojis will be used.
Password protection for the shortened URL. Users will need to enter this password to access the original URL.
Maximum number of clicks allowed for this shortened URL. Once reached, the URL will become inactive.
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.
The short code of the URL for which to retrieve statistics.
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.
The short code of the URL for which to export data.
Export format. Supported formats:
"json"
, "csv"
, "xlsx"
, "xml"
.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:SpooMeError
SpooMeError
Base exception class for all Spoo.me related errors.Attributes:
error_type
: The type of error (e.g., “UrlError”, “AliasError”)message
: Detailed error messagestatus_code
: HTTP status code
UrlError
UrlError
Raised when the provided URL is invalid or missing.
AliasError
AliasError
Raised when the requested alias is invalid or already taken.
PasswordError
PasswordError
Raised when the password doesn’t meet requirements.
RateLimitError
RateLimitError
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