Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
jupyter-naas
GitHub Repository: jupyter-naas/awesome-notebooks
Path: blob/master/Bitly/Bitly_Update_a_Bitlink.ipynb
2973 views
Kernel: Python 3

Bitly.png

Bitly - Update a Bitlink

Give Feedback | Bug report

Tags: #bitly #api #update #bitlink #reference #dev

Last update: 2023-04-12 (Created: 2023-02-24)

Description: This notebook will show how to update fields in the specified link using Bitly API.

Input

Import libraries

import requests

Setup Variables

token = "<YOUR_TOKEN_HERE>" bitlink = "<YOUR_BITLINK_HERE>" title = "<YOUR_TITLE_HERE>" long_url = "<YOUR_LONG_URL_HERE>"

Model

Update fields in the specified link.

url = f"https://api-ssl.bitly.com/v4/bitlinks/{bitlink}" headers = {"Authorization": f"Bearer {token}"} data = {"title": title, "long_url": long_url} response = requests.patch(url, headers=headers, json=data)

Output

Display result

response.json()