Skip to content

Commit 1705131

Browse files
committed
🎨 Shorten URL
1 parent ee51299 commit 1705131

File tree

3 files changed

+13
-0
lines changed

3 files changed

+13
-0
lines changed

requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
bitly-api==0.3

url-shortener/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# URL Shortener
2+
3+
[Link](https://towardsdatascience.com/best-apis-for-url-shortening-using-python-2db09d1f86f0)
4+
Library Repository: [bitly/bitly-api-python](https://github.com/bitly/bitly-api-python)

url-shortener/main.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import bitly_api
2+
3+
BITLY_ACCESS_TOKEN = "YOUR_ACCESS_TOKEN"
4+
ACCESS = bitly_api.Connection(access_token=BITLY_ACCESS_TOKEN)
5+
SHORT_URL = ACCESS.shorten(str(input()))
6+
7+
if __name__ == "__main__":
8+
print(f"Short URL = {SHORT_URL['url']}")

0 commit comments

Comments
 (0)