def replyinline(postidreply, poster):
# Use the to-be-replied-to post id:
replytoid = postidreply
replytoposter = poster
# Input some text:
posttext = input(Fore.YELLOW + Style.DIM + "Write some text: " + Style.RESET_ALL)
# Add '@', username to posttext:
posttext = ("@" + replytoposter + " " + posttext)
# 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 'repostinline' subroutine:
评论列表
文章目录