Home > other >  Ask, how to use python request WeChat small program database, do change.
Ask, how to use python request WeChat small program database, do change.

Time:09-30



Invalid format of 47001 POST BODY
Is a collection of increase request, format error, don't know what to do, how also can not find how to operate,

CodePudding user response:

The import requests, json
Url="https://api.weixin.qq.com/cgi-bin/token? Grant_type=client_credential & amp; Appid=xxxxx& Secret=XXXX "
Res=requests. Get (url)
Token=res. Json ()
Token=token (" access_token ")

Post_url="HTTP://https://api.weixin.qq.com/tcb/databaseupdate? Access_token="+ token
The body={
"Env" : "ymxsc,"
"Collection_name" : "XXXZZZ
"}
The content-type headers={' ':' application/json '}
Postgo=requests. Post (post_url, data=https://bbs.csdn.net/topics/json.dumps (body), headers=headers)
Print (postgo. Text)

This is all the code