def reply():
# INEFFICIENT: NEED TO MERGE MOST OF THE CODE FROM THIS AND THE REPLYINLINE SUBROUTINE:
# Input a reply-to post number:
replytoid = input(Fore.YELLOW + Style.DIM + "Post number to reply to: " + Style.RESET_ALL)
# Input some text:
posttext = input(Fore.YELLOW + Style.DIM + "Write some text (add usernames!): " + 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 = {'reply_to': replytoid, 'content': posttext}
response = requests.post(url, headers=headers, data=data)
# Displays the server's response:
responsestatus = response.status_code
showapiresponse(responsestatus)
# Define the 'replyinline' subroutine:
# INEFFICIENT: SEE THE REPLY SUBROUTINE:
评论列表
文章目录