踩个点! 在确保接口所需数据都无误的情况下,要注意编码,微信后台接收的media_id和实际传的存在编码上的不一致 def update_draft(_access_token, _data): api = "https://api.weixin.qq.com/cgi-bin/draft/update?access_token={}".format(_access_token) json_content = json.dumps(_data, ensure_ascii=False) headers = { 'Content-Type': 'application/json; charset=utf-8' } response = requests.post(api, data=json_content.encode("utf-8"), headers=headers) json_data = response.json() return json_data
修改草稿报errcode":40007,"errmsg":"invalid media_id?步骤: 1、先调https://api.weixin.qq.com/cgi-bin/draft/add?access_token=ACCESS_TOKEN 新建草稿接口,返回media_id 2、根据新建草稿接口返回的media_id请求https://api.weixin.qq.com/cgi-bin/draft/update?access_token=ACCESS_TOKEN 修改草稿接口,返回{"errcode":40007,"errmsg":"invalid media_id hint: [LM_f702014544] rid: 66e138e9-053abe5b-78f5f5a7"} 修改草稿参数:{ "index": 0, "articles": { "title": "1", "author": "3", "digest": "2", "content": "<section class=\"model-item active\" data-v-e8fdb3e6=\"\"><a href=\"javascript:;\" data-miniprogram-nickname=\"尊享图库\" data-miniprogram-appid=\"wxd1eef79856a1f4a4\" data-miniprogram-path=\"pagesExpert/pages/index-synthesize?user_id=68&type=pattern_name_package&sub_type=pattern_name\" data-v-e8fdb3e6=\"\"><section data-v-e8fdb3e6=\"\" style=\"font-size: 16px; color: rgb(0, 0, 0); line-height: 20px; letter-spacing: 0px;\">啊实打实啊实打实</section><section class=\"model-top-add\" data-v-e8fdb3e6=\"\"><i class=\"iconfont\" data-v-e8fdb3e6=\"\"></i></section><section class=\"model-handle\" data-v-e8fdb3e6=\"\"><uni-view class=\"type-title text\" data-v-e8fdb3e6=\"\">文本</uni-view><!--v-if--><uni-view class=\"btn-box\" data-v-e8fdb3e6=\"\"><uni-view class=\"item\" data-v-e8fdb3e6=\"\">编辑</uni-view><!-- <view class=\"item\" @click=\"editModel('space')\">间距</view>--><!-- <view class=\"item\" @click=\"editModel('clear')\">清空</view>--><!-- <view class=\"item\" @click=\"editModel('del')\">删除</view>--></uni-view><!--v-if--></section></a></section><section class=\"model-item\" data-v-e8fdb3e6=\"\"><a href=\"javascript:;\" data-miniprogram-nickname=\"尊享图库\" data-miniprogram-appid=\"wxd1eef79856a1f4a4\" data-miniprogram-path=\"pagesExpert/pages/index-synthesize?user_id=68&type=pattern_name_package&sub_type=pattern_name\" data-v-e8fdb3e6=\"\"><section data-v-e8fdb3e6=\"\" style=\"font-size: 16px; color: rgb(0, 0, 0); line-height: 20px; letter-spacing: 0px;\">啊实打实啊实打实</section><section class=\"model-top-add\" data-v-e8fdb3e6=\"\"><i class=\"iconfont\" data-v-e8fdb3e6=\"\"></i></section><section class=\"model-handle\" data-v-e8fdb3e6=\"\"><uni-view class=\"type-title text\" data-v-e8fdb3e6=\"\">文本</uni-view><!--v-if--><uni-view class=\"btn-box\" data-v-e8fdb3e6=\"\"><uni-view class=\"item\" data-v-e8fdb3e6=\"\">编辑</uni-view><!-- <view class=\"item\" @click=\"editModel('space')\">间距</view>--><!-- <view class=\"item\" @click=\"editModel('clear')\">清空</view>--><!-- <view class=\"item\" @click=\"editModel('del')\">删除</view>--></uni-view><!--v-if--></section></a></section><section class=\"model-item\" data-v-e8fdb3e6=\"\"><a href=\"javascript:;\" data-miniprogram-nickname=\"\" data-miniprogram-appid=\"\" data-miniprogram-path=\"\" data-v-e8fdb3e6=\"\"><img src=\"https://oss.tutushe.68mall.com/prod/images/2024/01/17/1705454125470febi0wo3.jpg\" lazy-load=\"\" data-v-e8fdb3e6=\"\" style=\"max-width: 100%;\"><section class=\"model-top-add\" data-v-e8fdb3e6=\"\"><i class=\"iconfont\" data-v-e8fdb3e6=\"\"></i></section><section class=\"model-handle\" data-v-e8fdb3e6=\"\"><uni-view class=\"type-title text\" data-v-e8fdb3e6=\"\">文本</uni-view><!--v-if--><uni-view class=\"btn-box\" data-v-e8fdb3e6=\"\"><uni-view class=\"item\" data-v-e8fdb3e6=\"\">编辑</uni-view><!-- <view class=\"item\" @click=\"editModel('space')\">间距</view>--><!-- <view class=\"item\" @click=\"editModel('clear')\">清空</view>--><!-- <view class=\"item\" @click=\"editModel('del')\">删除</view>--></uni-view><!--v-if--></section></a></section><section class=\"model-item\" data-v-e8fdb3e6=\"\"><a href=\"javascript:;\" data-miniprogram-nickname=\"\" data-miniprogram-appid=\"\" data-miniprogram-path=\"\" data-v-e8fdb3e6=\"\"><section data-v-e8fdb3e6=\"\"><!-- 模板内容 --><section class=\"title-panel title-01\" id=\"4\" data-v-e8fdb3e6=\"\" style=\"margin: 10px auto; display: flex; align-items: center; justify-content: center; width: 100%; box-sizing: border-box; font-family: "PingFang SC", Arial, Helvetica, "STHeiti STXihei", "Microsoft YaHei", Tohoma, sans-serif;\"><section class=\"line l\" style=\"flex-shrink: 0; border-right: 1px solid rgb(255, 108, 88); padding-right: 6px; box-sizing: border-box; transform: skew(-25deg);\"><section class=\"horizontal-line\" style=\"width: 40px; border-bottom: 1px solid rgb(255, 108, 88); border-right: 1px solid rgb(255, 108, 88); height: 14px;\"></section></section><section class=\"center\" style=\"font-size: 16px; color: rgb(255, 108, 88); line-height: 10px; letter-spacing: 0px; font-weight: bold; padding: 0px 10px; overflow-wrap: break-word;\"><section class=\"text\" style=\"color: rgb(255, 108, 88);\">爆火的网名</section></section><section class=\"line r\" style=\"flex-shrink: 0; border-left: 1px solid rgb(255, 108, 88); padding-left: 6px; box-sizing: border-box; transform: skew(-25deg);\"><section class=\"horizontal-line\" style=\"width: 40px; border-top: 1px solid rgb(255, 108, 88); border-left: 1px solid rgb(255, 108, 88); height: 14px;\"></section></section></section></section><section class=\"model-top-add\" data-v-e8fdb3e6=\"\"><i class=\"iconfont\" data-v-e8fdb3e6=\"\"></i></section><section class=\"model-handle\" data-v-e8fdb3e6=\"\"><uni-view class=\"type-title text\" data-v-e8fdb3e6=\"\">文本</uni-view><!--v-if--><uni-view class=\"btn-box\" data-v-e8fdb3e6=\"\"><uni-view class=\"item\" data-v-e8fdb3e6=\"\">编辑</uni-view><!-- <view class=\"item\" @click=\"editModel('space')\">间距</view>--><!-- <view class=\"item\" @click=\"editModel('clear')\">清空</view>--><!-- <view class=\"item\" @click=\"editModel('del')\">删除</view>--></uni-view><!--v-if--></section></a></section><section class=\"model-item\" data-v-e8fdb3e6=\"\"><a href=\"javascript:;\" data-miniprogram-nickname=\"\" data-miniprogram-appid=\"\" data-miniprogram-path=\"\" data-v-e8fdb3e6=\"\"><section data-v-e8fdb3e6=\"\"><!-- 模板内容 --><section class=\"title-panel title-02\" id=\"5\" data-v-e8fdb3e6=\"\" style=\"margin: 10px auto; display: flex; align-items: center; justify-content: center; width: 100%; box-sizing: border-box;\"><section class=\"line l\" style=\"flex-shrink: 0;\"><section class=\"horizontal-line\" style=\"background: rgb(104, 204, 208); width: 10px; height: 18px; box-sizing: border-box;\"></section></section><section class=\"center\" style=\"background: rgb(45, 100, 182); padding: 3px 15px;\"><section class=\"text\" style=\"color: rgb(255, 255, 255); line-height: 20px; letter-spacing: 0px; font-weight: bold;\">爆火的网名</section></section><section class=\"line r\" style=\"flex-shrink: 0;\"><section class=\"horizontal-line\" style=\"background: rgb(104, 204, 208); width: 10px; height: 18px; box-sizing: border-box;\"></section></section></section></section><section class=\"model-top-add\" data-v-e8fdb3e6=\"\"><i class=\"iconfont\" data-v-e8fdb3e6=\"\"></i></section><section class=\"model-handle\" data-v-e8fdb3e6=\"\"><uni-view class=\"type-title text\" data-v-e8fdb3e6=\"\">文本</uni-view><!--v-if--><uni-view class=\"btn-box\" data-v-e8fdb3e6=\"\"><uni-view class=\"item\" data-v-e8fdb3e6=\"\">编辑</uni-view><!-- <view class=\"item\" @click=\"editModel('space')\">间距</view>--><!-- <view class=\"item\" @click=\"editModel('clear')\">清空</view>--><!-- <view class=\"item\" @click=\"editModel('del')\">删除</view>--></uni-view><!--v-if--></section></a></section><section class=\"model-item\" data-v-e8fdb3e6=\"\"><a href=\"javascript:;\" data-miniprogram-nickname=\"\" data-miniprogram-appid=\"\" data-miniprogram-path=\"\" data-v-e8fdb3e6=\"\"><!-- 正文模板 --><section data-v-e8fdb3e6=\"\"><!-- 模板内容 --><section class=\"text-panel text-01\" id=\"6\" data-v-e8fdb3e6=\"\" style=\"margin: 10px auto; padding: 15px 5px; display: flex; align-items: center; justify-content: center; width: 100%; box-sizing: border-box; font-family: "PingFang SC", Arial, Helvetica, "STHeiti STXihei", "Microsoft YaHei", Tohoma, sans-serif;\"><section class=\"bg\" style=\"background: rgb(227, 241, 255); border-radius: 7px; box-sizing: border-box; transform: rotate(5deg);\"><section class=\"center-box\" style=\"background: rgb(255, 255, 255); border-radius: 7px; border: 1px solid rgb(72, 161, 254); padding: 10px 20px; box-sizing: border-box; transform: rotate(-5deg);\"><section class=\"icon l\" style=\"width: 20px; height: 20px; display: flex; font-family: fantasy; box-sizing: border-box; color: rgb(255, 128, 153); font-size: 50px; letter-spacing: 2px;\"><section class=\"q\" style=\"color: rgb(255, 196, 206);\">‘</section><section>‘</section></section><section class=\"center\" style=\"margin: 6px 0px;\"><section class=\"text\" style=\"font-size: 14px; color: rgb(51, 51, 51); line-height: 25px; letter-spacing: 1.5px; text-decoration: underline solid rgb(166, 210, 254); text-underline-offset: 5px;\">中国医师节是每年的8月19日,设立此节日旨在激励广大卫生与健康工作者大力弘扬“敬佑生命、救死扶伤、甘于奉献、大爱无疆”的崇高精神。</section></section><section class=\"icon r\" style=\"width: 20px; height: 20px; display: flex; font-family: fantasy; box-sizing: border-box; color: rgb(255, 128, 153); font-size: 50px; letter-spacing: 2px; margin-left: auto;\"><section>’</section><section class=\"q\" style=\"color: rgb(255, 196, 206);\">’</section></section></section></section></section></section><section class=\"model-top-add\" data-v-e8fdb3e6=\"\"><i class=\"iconfont\" data-v-e8fdb3e6=\"\"></i></section><section class=\"model-handle\" data-v-e8fdb3e6=\"\"><uni-view class=\"type-title text\" data-v-e8fdb3e6=\"\">文本</uni-view><!--v-if--><uni-view class=\"btn-box\" data-v-e8fdb3e6=\"\"><uni-view class=\"item\" data-v-e8fdb3e6=\"\">编辑</uni-view><!-- <view class=\"item\" @click=\"editModel('space')\">间距</view>--><!-- <view class=\"item\" @click=\"editModel('clear')\">清空</view>--><!-- <view class=\"item\" @click=\"editModel('del')\">删除</view>--></uni-view><!--v-if--></section></a></section><section class=\"model-item\" data-v-e8fdb3e6=\"\"><a href=\"javascript:;\" data-miniprogram-nickname=\"\" data-miniprogram-appid=\"\" data-miniprogram-path=\"\" data-v-e8fdb3e6=\"\"><section data-v-e8fdb3e6=\"\"><section class=\"template-panel image-text-panel image-text-01\" data-v-e8fdb3e6=\"\" style=\"margin: 10px auto; display: flex; flex-direction: column; width: 100%; box-sizing: border-box; font-family: "PingFang SC", Arial, Helvetica, "STHeiti STXihei", "Microsoft YaHei", Tohoma, sans-serif;\"><section class=\"icon\" style=\"width: 100px; margin-bottom: -150px; margin-left: auto; transform: rotateY(180deg);\"><img class=\"img\" src=\"https://szy-mms.oss-cn-beijing.aliyuncs.com/assets/expert-images/static/wechat-account/image-text-01-1.png\" style=\"max-width: 100%;\"></section><section class=\"center-box\" style=\"margin: 0px 25px; box-sizing: border-box; z-index: 1;\"><section class=\"title\" style=\"font-size: 16px; color: rgb(98, 169, 84); line-height: 20px; letter-spacing: 1.5px; text-align: left; font-weight: bold; margin-bottom: 15px;\">时在天长,正当大暑</section><img class=\"img\" src=\"https://oss.tutushe.68mall.com/prod/images/2024/09/09/1725865915290kecdzi3y.jpg\" style=\"max-width: 100%; width: 100%; border-radius: 10px; overflow: hidden;\"><section class=\"center\" style=\"margin: 6px 0px;\"><section class=\"text\" style=\"font-size: 14px; color: rgb(51, 51, 51); line-height: 20px; letter-spacing: 1.5px; text-align: justify;\">大暑,是夏天的极致,也是生命力量的展现。在这个季节里,每一个生命都在以自己的方式诉说着对生活的热爱与追求,共同编织出一幅幅生动而绚丽的夏日画卷。阳光如熔金般炽热,将万物笼罩在一片耀眼的金黄之中。</section></section><img class=\"\" src=\"https://szy-mms.oss-cn-beijing.aliyuncs.com/assets/expert-images/static/wechat-account/image-text-01-3.gif\" style=\"max-width: 100%;\"></section></section></section><section class=\"model-top-add\" data-v-e8fdb3e6=\"\"><i class=\"iconfont\" data-v-e8fdb3e6=\"\"></i></section><section class=\"model-handle\" data-v-e8fdb3e6=\"\"><uni-view class=\"type-title text\" data-v-e8fdb3e6=\"\">文本</uni-view><!--v-if--><uni-view class=\"btn-box\" data-v-e8fdb3e6=\"\"><uni-view class=\"item\" data-v-e8fdb3e6=\"\">编辑</uni-view><!-- <view class=\"item\" @click=\"editModel('space')\">间距</view>--><!-- <view class=\"item\" @click=\"editModel('clear')\">清空</view>--><!-- <view class=\"item\" @click=\"editModel('del')\">删除</view>--></uni-view><!--v-if--></section></a></section>", "thumb_media_id": "eRZn_bSsMxLdfB7DL1EMST3BM2_Dt5_PUKSfnsgmzFIe5OQYEee8EISeuiqcTh_o" }, "media_id": "eRZn_bSsMxLdfB7DL1EMScUraQS2Km3vtFD0XpNOdxDn6BacGD3fd03sO-WiVWc1" }
11-20