# advurl_shortner - Advanced URL Shortener for Python
[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE.md)
Easy-to-use, powerful python library to help you to shorten urls with advanced options. Supports multiple domains, URL TTL, split tests, visit statistics etc.
An extended native Python wrapper for [AdvUrlShortner API](https://github.com/advUrlShortner/API/) with minimal requirements. Supports all methods and types of responses.
## Features
- Easy to use
- Multiple domains
- URL TTL (Time-To-Live) in seconds. Auto expiry URL after some time.
- Redirect to second URL after primary URL expires (TTL)
- Randomized and weighted randomnized redirect to different URLs (split tests etc.)
- Password-protected statistics of visits to a shortened URL
- Password protected shortened URL parameters (TTL, second URL, etc.)
## Installation
In order install this package, simply run:
```bash
pip install advurl_shortner
```
## Usage
To use shorten_url, you first need to import the package:
```python
import advurl_shortner
```
### Shorten URL:
```python
advurl_shortner.short("https://google.com/")
# Returns the shortened URLs in JSON
# Example: {"urls": ["https://liii.pw/N", "https://illi.ink/N", "https://illi.cfd/N"]}
advurl_shortner.short("https://google.com/", description="Google search engine", password="1234x")
# Returns shortened URLs, sets a password to access visiting statistics and shortened URL parameters.
advurl_shortner.short("https://google.com/", ttl=86400)
# Returns the shortened URLs., after 24 hours (86400 seconds) will return "The Link You Followed Has Expired"
advurl_shortner.short("https://google.com/", ttl=86400, second_url="https://bing.com/")
# Returns the shortened URLs., after 24 hours (86400 seconds) shortened link will redirect to second_url
advurl_shortner.short("https://google.com/",second_url="https://bing.com/")
# Returns shortened URLs. The shortened link is randomly redirected to one of the provided URLs.
advurl_shortner.short("https://google.com/",second_url="https://bing.com/", weights=[0.3, 0.7])
# Returns shortened URLs.
# The shortened link is randomly (weighted by weight parameter) redirected to one of the provided URLs.
# approximately 30% to "https://google.com/ and 70% to "https://bing.com/"
```
### Getting short URL parameters and visit statistics:
```python
advurl_shortner.stat("https://illi.cfd/H","aaa")
# Returns the parameters and visit statistics of the shortened URL stored with password "1234x".
# Example:
#{
# "url": "http://google.com/?z=1",
# "second_url": "http://yahoo.com/",
# "ttl": null,
# "date_created": "1703411470",
# "weights": null,
# "description":"Yahoo search engine",
# "visits": 4,
# "primary_url_expired": false
#}
```
### TODO:
- More than 2 URLs
- Advanced visit statistics
Raw data
{
"_id": null,
"home_page": "https://github.com/advUrlShortner/advurl-shortner-python",
"name": "advurl-shortner",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*",
"maintainer_email": "",
"keywords": "url,shorten,url_shortner,API",
"author": "Paul Jakobski",
"author_email": "",
"download_url": "https://files.pythonhosted.org/packages/49/9f/bfa0227deee23835b6029837aaba7703756a500f4c7ef8891905eb7ae456/advurl_shortner-1.0.3.tar.gz",
"platform": null,
"description": "# advurl_shortner - Advanced URL Shortener for Python\n\n[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE.md)\n\nEasy-to-use, powerful python library to help you to shorten urls with advanced options. Supports multiple domains, URL TTL, split tests, visit statistics etc.\nAn extended native Python wrapper for [AdvUrlShortner API](https://github.com/advUrlShortner/API/) with minimal requirements. Supports all methods and types of responses.\n\n## Features\n\n- Easy to use\n- Multiple domains\n- URL TTL (Time-To-Live) in seconds. Auto expiry URL after some time.\n- Redirect to second URL after primary URL expires (TTL)\n- Randomized and weighted randomnized redirect to different URLs (split tests etc.)\n- Password-protected statistics of visits to a shortened URL\n- Password protected shortened URL parameters (TTL, second URL, etc.)\n\n## Installation\n\nIn order install this package, simply run:\n\n```bash\npip install advurl_shortner\n```\n\n\n## Usage\n\nTo use shorten_url, you first need to import the package:\n\n```python\nimport advurl_shortner\n```\n\n\n### Shorten URL:\n\n```python\n\nadvurl_shortner.short(\"https://google.com/\")\n# Returns the shortened URLs in JSON\n# Example: {\"urls\": [\"https://liii.pw/N\", \"https://illi.ink/N\", \"https://illi.cfd/N\"]}\n\nadvurl_shortner.short(\"https://google.com/\", description=\"Google search engine\", password=\"1234x\")\n# Returns shortened URLs, sets a password to access visiting statistics and shortened URL parameters.\n\nadvurl_shortner.short(\"https://google.com/\", ttl=86400)\n# Returns the shortened URLs., after 24 hours (86400 seconds) will return \"The Link You Followed Has Expired\"\n\nadvurl_shortner.short(\"https://google.com/\", ttl=86400, second_url=\"https://bing.com/\")\n# Returns the shortened URLs., after 24 hours (86400 seconds) shortened link will redirect to second_url\n\nadvurl_shortner.short(\"https://google.com/\",second_url=\"https://bing.com/\")\n# Returns shortened URLs. The shortened link is randomly redirected to one of the provided URLs.\n\nadvurl_shortner.short(\"https://google.com/\",second_url=\"https://bing.com/\", weights=[0.3, 0.7])\n# Returns shortened URLs.\n# The shortened link is randomly (weighted by weight parameter) redirected to one of the provided URLs.\n# approximately 30% to \"https://google.com/ and 70% to \"https://bing.com/\"\n\n\n\n```\n### Getting short URL parameters and visit statistics:\n\n```python\nadvurl_shortner.stat(\"https://illi.cfd/H\",\"aaa\")\n# Returns the parameters and visit statistics of the shortened URL stored with password \"1234x\".\n# Example:\n#{\n#\t\"url\": \"http://google.com/?z=1\",\n#\t\"second_url\": \"http://yahoo.com/\",\n#\t\"ttl\": null,\n#\t\"date_created\": \"1703411470\",\n#\t\"weights\": null,\n#\t\"description\":\"Yahoo search engine\",\n#\t\"visits\": 4,\n#\t\"primary_url_expired\": false\n#}\n```\n\n### TODO:\n- More than 2 URLs\n- Advanced visit statistics\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Easy-to-use, powerful python library to help you to shorten urls with advanced options.",
"version": "1.0.3",
"project_urls": {
"Homepage": "https://github.com/advUrlShortner/advurl-shortner-python"
},
"split_keywords": [
"url",
"shorten",
"url_shortner",
"api"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "6d2d41e2462dd405c8997282efaed3652118463275b5929dfca02c227ddb900d",
"md5": "9121ae8cbdeb3ad94cf403dd53e7f6ec",
"sha256": "76c42325006d50d5da0ca417231234d273b59819dcfa96d7c2140d73712009f8"
},
"downloads": -1,
"filename": "advurl_shortner-1.0.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "9121ae8cbdeb3ad94cf403dd53e7f6ec",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*",
"size": 3958,
"upload_time": "2024-01-08T16:40:17",
"upload_time_iso_8601": "2024-01-08T16:40:17.823145Z",
"url": "https://files.pythonhosted.org/packages/6d/2d/41e2462dd405c8997282efaed3652118463275b5929dfca02c227ddb900d/advurl_shortner-1.0.3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "499fbfa0227deee23835b6029837aaba7703756a500f4c7ef8891905eb7ae456",
"md5": "cc708e819e129944634c50874f6e96df",
"sha256": "9eafb48abefc1b30262f3c9ef32c65ca79b1a3d9d6f8404882ce1e6d5f1b835c"
},
"downloads": -1,
"filename": "advurl_shortner-1.0.3.tar.gz",
"has_sig": false,
"md5_digest": "cc708e819e129944634c50874f6e96df",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*",
"size": 3611,
"upload_time": "2024-01-08T16:40:19",
"upload_time_iso_8601": "2024-01-08T16:40:19.465172Z",
"url": "https://files.pythonhosted.org/packages/49/9f/bfa0227deee23835b6029837aaba7703756a500f4c7ef8891905eb7ae456/advurl_shortner-1.0.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-01-08 16:40:19",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "advUrlShortner",
"github_project": "advurl-shortner-python",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "advurl-shortner"
}