shell pip install shorten python import shorten import requests python shorten_client = shorten.Shorten() python long_url = "https://www.example.com/some/long/url" short_url = shorten_client.shorten_url(long_url) print("Shortened URL:", short_url) python original_url = shorten_client.restore_url(short_url) print("Original URL:", original_url) python long_url = "https://www.example.com/some/long/url" short_url = shorten_client.shorten_url(long_url, suffix="short") print("Shortened URL with suffix:", short_url) python try: short_url = shorten_client.shorten_url(long_url) except shorten.ShortenError as e: print("An error occurred:", str(e)) python shorten_client.config.retry_attempts = 5 shorten_client.config.timeout = 10


上一篇:
下一篇:
切换中文