Created
November 29, 2022 10:02
-
-
Save anir0y/8eddd0af1cedd35ae8304237452fd92e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
import json | |
headers = { | |
'Authorization': 'Bearer {TOKEN}', | |
'Content-Type': 'application/json', | |
} | |
url= input('Enter Domain(with HTTP): ') | |
#url = 'https://'+url | |
data = '{ "long_url": "' + url + '", "domain": "bit.ly", "group_guid": "{guuid}" }' # SOMETHIG LIKE this: Bl3ib2L7r8h (gourp ID) | |
response = requests.post('https://api-ssl.bitly.com/v4/shorten', headers=headers, data=data) | |
blob = response.text | |
person_dict = json.loads(blob) | |
link = (person_dict['link']) | |
print(f"Bitly URL is: {link}") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment