{"id":24395,"library":"pyshorteners","title":"PyShorteners","description":"A Python library that wraps and consumes the most popular URL shortener APIs, including TinyURL, Bitly, and others. Current version 1.0.1, released in 2021; development appears stalled but library is functional. Supports Python 3.6+.","status":"active","version":"1.0.1","language":"python","source_language":"en","source_url":"https://github.com/ellisonleao/pyshorteners/","tags":["url-shortener","tinyurl","bitly","shorten-urls"],"install":[{"cmd":"pip install pyshorteners","lang":"bash","label":"Install"}],"dependencies":[{"reason":"HTTP client for API calls","package":"requests","optional":false}],"imports":[{"note":"Shortener is a class inside the module, not a direct import. Import pyshorteners then instantiate pyshorteners.Shortener().","wrong":"from pyshorteners import Shortener","symbol":"Shortener","correct":"import pyshorteners\ns = pyshorteners.Shortener()"}],"quickstart":{"code":"import pyshorteners\n\ns = pyshorteners.Shortener()\n# For services requiring API keys, set them via env or kwargs\n# short_url = s.tinyurl.short('https://www.example.com')\n# print(short_url)\n\n# Example with valid URL\nlong_url = 'https://www.example.com'\nshort_url = s.tinyurl.short(long_url)\nprint(short_url)\n","lang":"python","description":"Quickstart: import pyshorteners, create Shortener instance, call a provider's .short() method."},"warnings":[{"fix":"Update imports: replace 'from pyshorteners import Shortener' with 'import pyshorteners' and use pyshorteners.Shortener().tinyurl.short(url).","message":"Version 1.0.0 removed the old Shortener class pattern. The new API uses pyshorteners.Shortener() and provider-specific methods (e.g., .tinyurl.short()). No more global short() function.","severity":"breaking","affected_versions":">=1.0.0,<2.0.0"},{"fix":"Switch to active services like TinyURL (no API key) or Bitly (requires API key).","message":"Some providers like Google URL Shortener (goo.gl) are deprecated or shut down. Using them will raise errors.","severity":"deprecated","affected_versions":">=1.0.0"},{"fix":"Set API keys via environment variable or pass to Shortener constructor: pyshorteners.Shortener(bitly_token=os.environ.get('BITLY_TOKEN')).","message":"Many providers (Bitly) require an API key. If not set, they silently fail or raise an error. Always check provider docs.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Run: pip install pyshorteners","cause":"Library not installed.","error":"ModuleNotFoundError: No module named 'pyshorteners'"},{"fix":"Replace 'from pyshorteners import Shortener' with 'import pyshorteners' and use pyshorteners.Shortener().","cause":"Incorrect import pattern (e.g., from pyshorteners import Shortener). The correct import is 'import pyshorteners'.","error":"AttributeError: module 'pyshorteners' has no attribute 'Shortener'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}