Package: py-spoo-url
🚀 Simple URL shortening with advanced analytics, emoji aliases, and more using spoo.me📖 Table of Contents📦 Installing📥 Importing✂️ Shortening URLFor Non-emoji aliases😎 For Emoji aliases📊 URL Statistics🔧 Initializing the class👀 Viewing the Basic StatisticsExample Usage📈 Generating Insightful ChartsValid Data that can be passed to make the chartValid Chart typesUsage Example👀 Heatmap Preview📤 Exporting Stats Data🧳 Dependencies🚨 Error Codes🤝 Support and Issues🤗 Contributing📜 Licence📦 InstallingYou can install this package using pip:pipinstallpy_spoo_url📥 Importingfrompy_spoo_urlimportShorten,Statistics✂️ Shortening URLFor Non-emoji aliasesshortener=Shortener()long_url="https://www.example.com"short_url=shortener.shorten(long_url,password="SuperSecretPassword@444",max_clicks=100)# for custom alias, put `alias=<your_choice>`print(f"Shortened URL:{short_url}")😎 For Emoji aliasesshortener=Shortener()long_url="https://www.example.com"emoji_url=shorten.emojify(long_url)# pass password and max-clicks as shown above if you want# for custom emoji alias, put `emoji_alias=<random_emoji_sequence>`print(f"Emojified URL:{emoji_url}")Note:The emoji sequence must contain actual emojies like😆🤯...📊 URL StatisticsThe Statistics class enables you to retrieve detailed statistics for a given short code.🔧 Initializing the classfromspoo_meimportStatistics# Initialize Statistics with a short codestats=Statistics(short_code="ga")# replace with the shortcode you want# if the shortUrl is password protected you have to pass the password too👀 Viewing the Basic Statisticsprint(f"Total Clicks:{stats.total_clicks}")print(f"Total Unique Clicks:{stats.total_unique_clicks}")print(f"Average Daily Clicks:{stats.average_daily_clicks}")print(f"Clicks Analysis:{stats.clicks_analysis}")print(f"Browser Analysis:{stats.browsers_analysis}")# ... and more (details below)List of the analytics you can accessMethod/AttributeDescriptiontotal_clicksTotal number of clicks on the short URL.total_unique_clicksTotal number of unique clicks on the short URL.average_daily_clicksAverage number of clicks per day.average_monthly_clicksAverage number of clicks per month.average_weekly_clicksAverage number of clicks per week.last_clickInformation about the last click on the short URL.last_click_browserBrowser used for the last click.last_click_platformOperating system used for the last click.created_atDate when the short URL was created.creation_timeTime of day when the short URL was created.browsers_analysisAnalysis of browsers used for clicks.platforms_analysisAnalysis of operating systems used for clicks.country_analysisAnalysis of countries from which clicks originated.referrers_analysisAnalysis of referrers (sources) of clicks.clicks_analysisDetailed analysis of daily clicks.unique_browsers_analysisAnalysis of unique browsers used for clicks.unique_platforms_analysisAnalysis of unique operating systems for clicks.unique_country_analysisAnalysis of unique countries from which clicks originated.unique_referrers_analysisAnalysis of unique referrers (sources) of clicks.unique_clicks_analysisDetailed analysis of daily unique clicks.expiredIndicates if the short URL has expired.passwordPassword associated with the short URL (if any).Example Usageprint(f"Creation Time:{stats.creation_time}")📈 Generating Insightful Chartsplt=stats.make_chart(data="browsers_analysis",chart_type="bar")# this returns an object of matplotlibplt.show()# ... and more (see below)# generating countries heatmapsplt=stats.make_countries_heatmap()plt.savefig("heatmap.png",format="png",bbox_inches="tight",pad_inches=0.5,dpi=300,)plt=stats.make_unique_countries_heatmap()plt.savefig("unique_heatmap.png",format="png",bbox_inches="tight",pad_inches=0.5,dpi=300,)List of Available ChartsMethodDescriptionmake_chartCreate various types of charts based on the data provided.ParametersDescriptiondataType of data to visualize (e.g., 'browsers_analysis', see below).chart_typeType of chart to create (e.g., "bar", "pie", "line", see below).daysNumber of days to consider for time-based analysis. (only forlast_n_days_analysisandlast_n_days_unique_analysis)Valid Data that can be passed to make the chart'browsers_analysis''platforms_analysis''country_analysis''referrers_analysis''clicks_analysis''unique_browsers_analysis''unique_platforms_analysis''unique_country_analysis''unique_referrers_analysis''unique_clicks_analysis''last_n_days_analysis''last_n_days_unique_analysis'Valid Chart types'bar''pie''line''scatter''hist''box''area'Usage Exampleplt=stats.make_chart('browsers_analysis',chart_type="bar")plt.show()👀 Heatmap Preview📤 Exporting Stats DataYou can export the statistical data to various file formats, including Excel, CSV, and JSON:# Export data to Excelstats.export_data(filename="stats_export.xlsx",filetype="xlsx")# Export data to CSV and compress into a ZIP filestats.export_data(filename="stats_export",filetype="csv")# Export data to Jsonstats.export_data(filename="stats_export.json",filetypes="json")🧳 Dependenciesmatplotlib: For creating charts and visualizations.requests: For making HTTP requests to the Spoo.me API.pandas: For handling and manipulating data in tabular form. 🐼geopandas: For creating geographical visualizations. 🌎All of the dependencies are automatically installed while installing the package but in case of any errors, you can install all of the dependencies listed in therequirements.txtfile.🚨 Error CodesTo see the error codes returned by the API, please visithttps://spoo.me/api🤝 Support and IssuesIf you encounter any issues or have questions about using the Spoo.me Python package, please open an issue on the GitHub repository.🤗 ContributingContributions are welcome! If you have ideas for improvements or new features, feel free to fork the repository, make your changes, and submit a pull request📜 LicenceThis package is licensed under the MIT License - see the LICENSE file for details.© spoo.me . 2024All Rights Reserved