def post():
# Input blog post data:
posttitle = input(Fore.YELLOW + Style.DIM + "Write a blog post title: " + Style.RESET_ALL)
print(Fore.YELLOW + Style.DIM + "Write a blog post:")
print("(Press [ctrl-d] to 'save' when you finish writing.)" + Style.RESET_ALL)
posttext = sys.stdin.read()
# Adds a post date & time, currently set as 'now':
postdatetime = strftime("%Y-%m-%d %H:%M:%S")
# Uses the global header & creates the data to be passed to the url:
url = 'https://api.10centuries.org/content'
# IMPORTANT: @bazbt3's channel_id = 6. SUBSTITUTE WITH YOUR CHANNEL_ID in global definitions!
data = {'title': posttitle, 'content': posttext, 'channel_id': channelid, 'send_blurb': 'Y', 'pubdts': postdatetime}
response = requests.post(url, headers=headers, data=data)
# Displays the server's response:
responsestatus = response.status_code
showapiresponse(responsestatus)
# Define the 'reply' subroutine:
评论列表
文章目录