Skip to content
Discussion options

You must be logged in to vote

To offer multiple services, you could create a menu for the user to choose a preferred service (e.g., TinyURL, Bitly) and then use the corresponding method in pyshorteners. For example:

services = {
"1": "TinyURL",
"2": "Bitly",
"3": "Isgd",
}
print("Choose a URL shortening service:\n1. TinyURL\n2. Bitly\n3. Isgd")
choice = input("Enter the number of your choice: ")
url = input("Enter URL which you want to shorten: \n")
try:
shortener = pyshorteners.Shortener()
if choice == "1":
print("URL After Shortening: ", shortener.tinyurl.short(url))
elif choice == "2":
print("URL After Shortening: ", shortener.bitly.short(url))
elif choice == "3":
…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected bynirsa1001
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
@nirsa1001@amark720