Skip to content

Commit d46a66b

Browse files
authored
Merge pull request #113 from Sapna2001/urlShortener
URL Shortener
2 parents a6347e0 + 3eba2a2 commit d46a66b

File tree

3 files changed

+36
-0
lines changed

3 files changed

+36
-0
lines changed

Python/URL_Shortener/Readme.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# URL Shortener
2+
3+
This script provides a shortened URL on the command line.
4+
5+
## Requirement for this script:
6+
7+
1. pyshorteners
8+
9+
install it by running the following command in the command prompt:
10+
11+
pip install pyshorteners
12+
13+
## How to use this script?
14+
15+
Just type the following in your command prompt:
16+
17+
python script.py
18+
19+
## Sample of the script in action:
20+
21+
![demo](https://user-images.githubusercontent.com/56690856/96848723-69df4800-1472-11eb-850e-aad8064eaf5e.png)

Python/URL_Shortener/requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
pyshorteners

Python/URL_Shortener/script.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#import pyshorteners library
2+
import pyshorteners
3+
4+
# input URL
5+
url = input("Enter the URL:")
6+
7+
# class object
8+
shortener = pyshorteners.Shortener()
9+
10+
# shortened URl
11+
urlShort = shortener.tinyurl.short(url)
12+
13+
# print shortened URL
14+
print("The shortened URL is:" + urlShort)

0 commit comments

Comments
 (0)