<jupyter_start><jupyter_text>Canny - Create   Enter credentials<jupyter_code>import requests
import json
import pandas as pd
canny_api = "**********"                             # api key of canny
post_title = "Post title"                            # Enter post title                    
post_body = "Post body using canny api"              # Enter post body<jupyter_output><empty_output><jupyter_text>Board dataframe using api-key<jupyter_code>api_key = {
"apiKey":canny_api          
}
limit = {
"limit":"100"                          
}
response = requests.get("https://canny.io/api/v1/boards/list")
response = requests.post("https://canny.io/api/v1/boards/list", 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'})
board_list<jupyter_output><empty_output><jupyter_text>Enter board name<jupyter_code>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
board_id = {
"boardID":board_id                          
}<jupyter_output><empty_output><jupyter_text>Using api and board name to get author list<jupyter_code>response = requests.get("https://canny.io/api/v1/posts/list")
data = {**api_key, **board_id, **limit}
response = requests.post("https://canny.io/api/v1/posts/list", 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'})
author_list<jupyter_output><empty_output><jupyter_text>Enter author name<jupyter_code>author_name = "<NAME>"  #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                          
}<jupyter_output><empty_output><jupyter_text>Creating post<jupyter_code>post_title = {
"title":post_title                                    
}
post_body = {
"details":post_body                    
}
data = {**api_key, **author_id, **board_id, **post_body, **post_title}
response = requests.post("https://canny.io/api/v1/posts/create", data)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.15056179775280898, 'fraction_numerical': 0.0033707865168539327, 'mean_word_length': 4.00187265917603, 'pattern_counts': {'":': 6, '<': 26, '<?xml version=': 0, '>': 26, 'https://': 5, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '6', 'dir': 'jupyter-structured-clean-dedup', 'id': '294358', 'license': 'BSD-3-Clause', 'n_tokens_mistral': 917, 'n_tokens_neox': 916, 'n_words': 156, 'path': 'Canny/Canny_Create.ipynb', 'repo_name': 'stjordanis/awesome-notebooks', 'size': '2675'}