{ "info": { "author": "Ellison Le\u00e3o", "author_email": "ellisonleao@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", "Operating System :: OS Independent", "Programming Language :: Python :: 2", "Programming Language :: Python :: 3", "Topic :: Internet :: WWW/HTTP :: Dynamic Content", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "pyshorteners\n============\n\n[![Build\nStatus](http://img.shields.io/travis/ellisonleao/pyshorteners.svg)](https://travis-ci.org/ellisonleao/pyshorteners)\n[![Number of PyPI downloads](http://img.shields.io/pypi/dm/pyshorteners.svg)](https://pypi.python.org/pypi/pyshorteners)\n[![Code\nHealth](https://landscape.io/github/ellisonleao/pyshorteners/master/landscape.svg)](https://landscape.io/github/ellisonleao/pyshorteners/master)\n[![codecov.io](http://codecov.io/github/ellisonleao/pyshorteners/coverage.svg?branch=master)](http://codecov.io/github/ellisonleao/pyshorteners?branch=master)\n\n\n# Description\n\nA simple URL shortening Python Lib, implementing the most famous\nshorteners.\n\n# Installing\n\nYou can install pythorteners by pip or cloning/forking the repository\nand just typing\n\nInstalling via pip\n\n pip install pyshorteners\n\nInstalling with the cloned/downloaded code\n\n\tgit clone https://github.com/ellisonleao/pyshorteners.git\n\tcd pyshorteners\n python setup.py install\n\nInstalling latest without cloning\n\n\tpip install -e git+git@github.com:ellisonleao/pyshorteners.git#egg=pyshorteners\n\n\n# Testing\n\n\tmake test\n\n# Usage\n\nCreate a Shortener instance passing the engine as an argument. Google\nShortener is the default engine if no engine param is passed.\n\n## Goo.gl Shortener\n\n`api_key` needed on kwargs\n\n```python\nfrom pyshorteners import Shortener\n\nurl = 'http://www.google.com'\napi_key = 'YOUR_API_KEY'\nshortener = Shortener('Google', api_key=api_key)\nprint \"My short url is {}\".format(shortener.short(url))\n\n### expanding\nurl = 'http://goo.gl/SsadY'\nprint \"My long url is {}\".format(shortener.expand(url))\n```\n\n## Bit.ly Shortener\n\n`bitly_token` needed on kwargs\n\n```python\nfrom pyshorteners import Shortener\n\n# For Bit.ly you HAVE to provide the login and api key\naccess_token = 'MY_ACCESS_TOKEN'\n\nurl = 'http://www.google.com'\nshortener = Shortener('Bitly', bitly_token=access_token)\nprint \"My short url is {}\".format(shortener.short(url))\n\n### expanding\nurl = 'http://bit.ly/AvGsb'\nprint \"My long url is {}\".format(shortener.expand(url))\n```\n\n## TinyURL.com Shortener\n\nNo login or api key needed\n\n```python\nfrom pyshorteners import Shortener\n\nurl = 'http://www.google.com'\nshortener = Shortener('Tinyurl')\nprint \"My short url is {}\".format(shortener.short(url))\n\n### expanding\nurl = 'http://tinyurl.com/ycus76'\nprint \"My long url is {}\".format(shortener.expand(url))\n```\n\n## Adf.ly Shortener\n\n`uid` and `api_key` needed, Banner `type` optional (`int` or `banner`).\nNo expanding for this shortener\n\n```python\nfrom pyshorteners import Shortener\n\nurl = 'http://www.google.com'\nshortener = Shortener('Adfly')\nprint \"My short url is {}\".format(shortener.short(url, uid=UID,\n api_key=API_KEY, type='int'))\n```\n\n## Is.gd Shortener\n\nNo login or api key needed\n\n```python\nfrom pyshorteners import Shortener\n\nurl = 'http://www.google.com'\nshortener = Shortener('Isgd')\nprint \"My short url is {}\".format(shortener.short(url))\n\n### expanding\nurl = 'http://is.gd/SsaC'\nprint \"My long url is {}\".format(shortener.expand(url))\n```\n\n## Senta.la Shortener\n\nNo login or api key needed\n\n```python\nfrom pyshorteners import Shortener\n\nurl = 'http://www.google.com'\nshortener = Shortener('Sentala')\nprint \"My short url is {}\".format(shortener.short(url))\n\n### expanding\nurl = 'http://senta.la/urubu'\nprint \"My long url is {}\".format(shortener.expand(url))\n```\n\n## Qr.cx Shortener\n\nNo login or api key needed\n\n```python\nfrom pyshorteners import Shortener\n\nurl = 'http://www.google.com'\nshortener = Shortener('QrCx')\nprint \"My short url is {}\".format(shortener.short(url))\n\n### expanding\nurl = 'http://qr.cx/XsC'\nprint \"My long url is {}\".format(shortener.expand(url))\n```\n\n## Readbility Shortener\n\nNo login or api key needed\n\n```python\nfrom pyshorteners import Shortener\n\nurl = 'http://blog.arc90.com/2010/11/30/silence-is-golden/'\nshortener = Shortener('Readbility')\nprint \"My short url is {}\".format(shortener.short(url))\n\n### expanding\nurl = 'http://rdd.me/ycus76'\nprint \"My long url is {}\".format(shortener.expand(url))\n```\n\n## Ow.ly Shortener\n\n`api_key` needed on kwargs\n\n```python\nfrom pyshorteners import Shortener\n\n# For Ow.ly you HAVE to provide the login and api key\napi_key = 'MY_API_KEY'\n\nurl = 'http://www.google.com'\nshortener = Shortener('Owly',api_key=api_key)\nprint \"My short url is {}\".format(shortener.short(url))\n\n### expanding\nurl = 'http://ow.ly/AvGsb'\nprint \"My long url is {}\".format(shortener.expand(url))\n```\n\n## Osdb.link Shortener\n\n```python\nfrom pyshorteners import Shortener\n\nurl = 'http://www.google.com'\nshortener = Shortener('Osdb')\nprint \"My short url is {}\".format(shortener.short(url))\n```\n\n## da.gd Shortener\n\n```python\nfrom pyshorteners import Shortener\n\nurl = 'http://www.google.com'\nshortener = Shortener('Dagd')\nprint \"My short url is {}\".format(shortener.short(url))\n```\n\n# Generating QR Code\n\nYou can have the QR Code for your url by calling the `qr_code` method\nafter shortening your url.\n\n```python\nfrom pyshorteners import Shortener\n\nurl = 'http://www.google.com'\nshortener = Shortener('Tinyurl')\nshortener.short(url)\nprint shortener.qrcode()\n\nOutput\nhttp://chart.apis.google.com/chart?cht=qr&chl=http://tinyurl.com/1c2&chs=120x120\n```\nImage:\n\n![](http://chart.apis.google.com/chart?cht=qr&chl=http://tinyurl.com/1c2&chs=120x120)\n\n\n# Creating your own Shortener\n\nTo create your shortener handler you will need to:\n\n1. Create a new file on shorteners/ folder (e.g shorteners/myshort.py)\n2. Create a MyShortShortener class implementing `short`, `expand` and optionally `total_clicks` methods:\n\n```python\nclass MyShortShortener(BaseShortener):\n\tapi_url = 'http://myapishortener.com/api'\n\n\tdef short(self, url):\n\t\tpass\n\n\tdef expand(self, url):\n\t\tpass\n\n\tdef total_clicks(self, url):\n\t\tpass\n```\n3. If you need to pass extra keyword args like a `token` or `api_key` , you will need to handle it on the `__init__()` method.\n4. Import this shortener on `shorteners/__init__.py` file\n5. Send a PR with a test included\n\n# Passing a custom Shortener dynamically\n\nYou can create custome shorteners by implementig a class that provides\na mandatory `short` method:\n\n```python\n\nclass MyCustomShortenerClass(object):\n\n\tdef short(self, url):\n\t\tpass\n\nshortener = Shortener(engine=MyCustomShortenerClass) # That's it)\n```", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/ellisonleao/pyshorteners/", "keywords": null, "license": "MIT", "maintainer": null, "maintainer_email": null, "name": "pyshorteners", "package_url": "https://pypi.org/project/pyshorteners/", "platform": "any", "project_url": "https://pypi.org/project/pyshorteners/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/ellisonleao/pyshorteners/" }, "release_url": "https://pypi.org/project/pyshorteners/0.6.1/", "requires_dist": null, "requires_python": null, "summary": "A Python lib to consume the most used shorteners APIs", "version": "0.6.1" }, "last_serial": 2920917, "releases": { "0.5.6": [ { "comment_text": "", "digests": { "md5": "faab4f28655131870bc8720350915764", "sha256": "1eea4b826737fc76861cb4b69b4269aeccd247300c27393ed8866c76ddce6769" }, "downloads": -1, "filename": "pyshorteners-0.5.6.zip", "has_sig": false, "md5_digest": "faab4f28655131870bc8720350915764", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 17408, "upload_time": "2015-09-22T15:12:24", "url": "https://files.pythonhosted.org/packages/7e/43/abbb9a7c94dc74fe8d87ea914aa0f6f3301fe420d07a3b3f538547ad3e83/pyshorteners-0.5.6.zip" } ], "0.5.7": [ { "comment_text": "", "digests": { "md5": "972a28747d3b352fb3d406c0906e3b7f", "sha256": "e382ac727fa0b9b78b40e63953411a3a4b6ce57da4559b46a141083741ad7b6c" }, "downloads": -1, "filename": "pyshorteners-0.5.7.tar.gz", "has_sig": false, "md5_digest": "972a28747d3b352fb3d406c0906e3b7f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8566, "upload_time": "2015-09-22T17:38:35", "url": "https://files.pythonhosted.org/packages/40/70/e0b027374e09c1f9e8744a2e05770e315c37b263792b503e5f372967a6d5/pyshorteners-0.5.7.tar.gz" } ], "0.5.8": [ { "comment_text": "", "digests": { "md5": "5a5633d40fc94c92b890e198df8b1151", "sha256": "a65cdf1ee31371dde171c98ec178912073e1c6bf2559c0eba0d7fb933530cf9a" }, "downloads": -1, "filename": "pyshorteners-0.5.8.tar.gz", "has_sig": false, "md5_digest": "5a5633d40fc94c92b890e198df8b1151", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8562, "upload_time": "2015-11-05T17:35:07", "url": "https://files.pythonhosted.org/packages/e7/eb/c3a179a4c24da7af8d9723c741cb1219a328429a98d7d57036dff32d3533/pyshorteners-0.5.8.tar.gz" } ], "0.6.0": [ { "comment_text": "", "digests": { "md5": "b43b08e48a8dce3d7ab3a3d200061f8a", "sha256": "c3affc3c9d9ae72b4b0a322d74a1debe1fca88ce05e230f22f74434b955673be" }, "downloads": -1, "filename": "pyshorteners-0.6.0.tar.gz", "has_sig": false, "md5_digest": "b43b08e48a8dce3d7ab3a3d200061f8a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9261, "upload_time": "2016-03-25T00:24:12", "url": "https://files.pythonhosted.org/packages/9e/19/86e745c9b07b1414e5fbc76bf92e5b725d9889b5f0949c8e3fbc33039918/pyshorteners-0.6.0.tar.gz" } ], "0.6.1": [ { "comment_text": "", "digests": { "md5": "9282579fb72368ec894dce6cb7f3bcd9", "sha256": "b499af0d7a3c6fe201d3e76df45b7243417cacb6b280a19220b3290e4271b887" }, "downloads": -1, "filename": "pyshorteners-0.6.1.tar.gz", "has_sig": false, "md5_digest": "9282579fb72368ec894dce6cb7f3bcd9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9820, "upload_time": "2017-06-02T16:27:29", "url": "https://files.pythonhosted.org/packages/b4/d0/9cc25d4e24a9709f53a9535be2af3db48227f2d6e7bfae5062813305ca51/pyshorteners-0.6.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "9282579fb72368ec894dce6cb7f3bcd9", "sha256": "b499af0d7a3c6fe201d3e76df45b7243417cacb6b280a19220b3290e4271b887" }, "downloads": -1, "filename": "pyshorteners-0.6.1.tar.gz", "has_sig": false, "md5_digest": "9282579fb72368ec894dce6cb7f3bcd9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9820, "upload_time": "2017-06-02T16:27:29", "url": "https://files.pythonhosted.org/packages/b4/d0/9cc25d4e24a9709f53a9535be2af3db48227f2d6e7bfae5062813305ca51/pyshorteners-0.6.1.tar.gz" } ] }