Tags: #canny #product #operations #snippet
Author: Martin Donadieu​
Last update: 2023-04-12 (Created: 2021-01-26)
Description: This notebook provides an easy-to-use interface for creating custom Canny edge detection filters.


Import librairies

import requests
import json
import pandas as pd

Enter credentials

canny_api = "CANNY_API_KEY" # api key of canny
post_title = "Post title" # Enter post title
post_body = "Post body using canny api" # Enter post body


Board dataframe using api-key

api_key = {"apiKey": canny_api}
limit = {"limit": "100"}
response = requests.get("")
response ="", api_key)
post_details = response.json()
db = post_details["boards"]
df = pd.DataFrame(columns=db[0].keys())
for i in range(len(db)):
df = df.append(db[i], ignore_index=True)
df = df[["name", "id"]]
board_list = df.rename(columns={"name": "BOARD_NAME", "id": "BOARD_ID"})

Enter board name

board_name = "Requests" # Enter board name
for i in range(len(board_list)):
if board_list["BOARD_NAME"][i] == board_name:
board_id = board_list["BOARD_ID"][i]
board_id = {"boardID": board_id}

Using api and board name to get author list

response = requests.get("")
data = {**api_key, **board_id, **limit}
response ="", data)
post_details = response.json()
# post_details['posts']
author_list = pd.DataFrame()
for i in range(len(post_details["posts"])):
author_list = author_list.append(
post_details["posts"][i]["author"], ignore_index=True
author_list.drop_duplicates(subset="email", keep=False, inplace=True)
author_list = author_list[["name", "id"]]
author_list = author_list.rename(columns={"name": "AUTHOR_NAME", "id": "AUTHOR_ID"})

Enter author name

author_name = "Sanjay Sabu" # Enter author name
for i in author_list["AUTHOR_NAME"].index:
if author_list["AUTHOR_NAME"][i] == author_name:
author_id = author_list["AUTHOR_ID"][i]
author_id = {"authorID": author_id}

Creating post

post_title = {"title": post_title}
post_body = {"details": post_body}
data = {**api_key, **author_id, **board_id, **post_body, **post_title}


Send the post

response ="", data)