def blurb():
# Input some text:
posttext = input(Fore.YELLOW + Style.DIM + "Write some text: " + Style.RESET_ALL)
# Saves the input text to 'posttext.txt':
file = open("posttext.txt", "w")
file.write(posttext)
file.close()
# Uses the global header & creates the data to be passed to the url:
url = 'https://api.10centuries.org/content'
data = {'content': posttext}
response = requests.post(url, headers=headers, data=data)
# Displays the server's response:
responsestatus = response.status_code
showapiresponse(responsestatus)
# Define the 'post' (blog post) subroutine:
评论列表
文章目录