ClownHe hai 1 ano
pai
achega
b8a2453101

+ 17 - 0
cppc_python脚本/服务器脚本/demo_meituanopenApi.py

@@ -0,0 +1,17 @@
+# -*- codeing = utf-8 -*-
+# @Time : 2024/3/12 15:58
+# @Author : Clown
+# @File : demo_meituanopenApi.py
+# @Software : PyCharm
+import requests
+
+url_city = 'https://openapi.meituan.com/poi/city'
+# resp = requests.get(url_city).text
+# print(resp)
+
+url_area = 'https://openapi.meituan.com/poi/area?cityid=82' #商圈接口
+resp = requests.get(url_area).json()
+for i in resp['data']:
+    print(i['name'])
+    for m in i['area']:
+        print(m)

+ 5 - 5
cppc_python脚本/服务器脚本/shopPointSearch.py

@@ -217,19 +217,19 @@ def searchAddressByShopId(json_params_in):
 
 
 if __name__ == '__main__':
-    if 1 == 0:
+    if 1 == 1:
         host = '124.222.188.59'
         passwd = '111...Clown'
         db_name = 'zuzu_data'
         port = 63306
         db = linkTomySql (host, passwd, db_name, port)
 
-        json_params_in = {'brandName':'粥小鲜',
-                          'wmPlate':'ELEME',
-                          'shopId':508370837}
+        json_params_in = {'brandName':'浆小白',
+                          'wmPlate':'MEITUAN',
+                          'shopId':20716671}
         result= searchAddressByShopId (json_params_in)
         print(result)
-    if 1==1:
+    if 1==0:
         address = {'address' :'上海市溧阳路111号'}
         print(baiduMapApiGeocoding (address))
 

+ 33 - 16
cppc_python脚本/服务器脚本/上传动态图.py

@@ -14,6 +14,8 @@ import sys
 from datetime import datetime,timedelta
 import json
 import pymysql
+from PIL import Image
+import base64
 
 def linkTomySql(host, passwd, db_name, port):
     '''连接至数据库返回【db】,v2新增local_infile=1 打开文件导入权限'''
@@ -81,6 +83,10 @@ def get_shops_info_to_list(db, brand_name, wm_plate, key_name):
             shops_info_df.append (shop_info_dict)
         return shops_info_df
 
+def image_to_base64(image_path):
+    with open(image_path, "rb") as image_file:
+        encoded_string = base64.b64encode(image_file.read()).decode("utf-8")
+    return encoded_string
 
 if __name__ == '__main__':
     host = '124.222.188.59'
@@ -103,23 +109,34 @@ if __name__ == '__main__':
     acctId = keys_dict['mt']['data']['session']['acctId']
     shop_id = 19666068
 
-    # file_path = r'C:\Users\ClownHe\Desktop\1业务支持需求单\美-暖冬.gif'
-    #
-    # files = {'multipart': open(file_path, 'rb')}
-    #
-    # data = {'needPicPropaganda':1}
-    #
-    # url = 'https://e.waimai.meituan.com/reuse/product/uploadTool/w/uploadImg'
-    #
-    # Cookie = cookie = f"token={token}; acctId={acctId}; wmPoiId={shop_id};"
-    #
-    # header = {
-    #     'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.131 Safari/537.36',
-    #     'Accept': 'application/json, text/plain, */*',
-    #     'Cookie': Cookie}
-    #
-    # resp = requests.post(url,files=files,data=data,headers=header).text
+    file_path = r'C:\Users\ClownHe\Desktop\1业务支持需求单\美-暖冬.gif'
+    # file_path = r'C:\Users\ClownHe\Desktop\1业务支持需求单\ceshi.jpg'
+    base64_str = image_to_base64(file_path)
+    # print(base64_str)
+
+    data = {'multipart':base64_str,'needPicPropaganda':1}
+
+    url = 'https://e.waimai.meituan.com/reuse/product/uploadTool/w/uploadImg'
+
+    Cookie = cookie = f"token={token}; acctId={acctId}; wmPoiId={shop_id};"
+
+    header = {
+        'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.131 Safari/537.36',
+        'Accept': 'application/json, text/plain, */*',
+        'Cookie': Cookie}
+
+    # resp = requests.post(url,data=data,headers=header).text
     # print(resp)
 
+    url_save = 'https://e.waimai.meituan.com/reuse/product/food/w/saveMultiImage'
+    json_save = {'wmPoiId':19666068,
+                 'newUrl':'http://p0.meituan.net/business/354250f999e92885a4390e07ad78005f1363077.gif?t=1705908020128',
+                 'spuId':12626543674,
+                 'sequence':2,
+                 'qualityScore':1,
+                 'picExtend':{"source":5}}
+    resp = requests.post(url_save,data=json_save,headers=header).text
+    print(resp)
+