def shorten_link(token, url):
    response = requests.post('https://api-ssl.bitly.com/v4/bitlinks', headers={'Authorization': 'Bearer {}'.format(token)}, json={'long_url': url})
    response.raise_for_status()
    return response.json()['link']
def shorten_link(token, url):
    response = requests.post('https://api-ssl.bitly.com/v4/bitlinks', headers={'Authorization': 'Bearer {}'.format(token)}, json={'long_url': url})
    response.raise_for_status()
    return response.json()['link']