10cbazbt3.py 文件源码

python
阅读 26 收藏 0 点赞 0 评论 0

项目:10cbazbt3 作者: bazbt3 项目源码 文件源码
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:
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号