From ba6c307282e961ddde5374762dc830932a7c3c91 Mon Sep 17 00:00:00 2001 From: kevin Date: Tue, 4 Jul 2023 16:33:31 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8F=AF=E4=BB=A5=E5=90=91=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E5=BA=93=E6=8F=90=E4=BA=A4item=20Signed-off-by:=20kevin=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- NS_temp1.json | 8 +++--- posttest.py | 75 +++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 79 insertions(+), 4 deletions(-) create mode 100644 posttest.py diff --git a/NS_temp1.json b/NS_temp1.json index 2b92fa0..fdcecd0 100644 --- a/NS_temp1.json +++ b/NS_temp1.json @@ -5,8 +5,8 @@ "SUK": "4510772220101", "salestart": "2023-01-19", "ZH": "熱血硬派國夫君外傳 熱血少女1+2", - "EN": " ", - "JP": " ", + "EN": "River City Girls 1 & 2", + "JP": "熱血硬派くにおくん外伝 リバーシティガールズ1・2", "TAG1": "日版", "TAG2": "中文", "TAG3": "日文" @@ -40,10 +40,10 @@ "type": "NS", "SUK": "4570045990018", "salestart": "2023-03-14", - "ZH": " ", + "ZH": "大鳥琥珀與刻之劍", "EN": " ", "JP": " ", - "TAG1": "大鳥琥珀與刻之劍", + "TAG1": " ", "TAG2": "日版", "TAG3": "中文" }, diff --git a/posttest.py b/posttest.py new file mode 100644 index 0000000..308af88 --- /dev/null +++ b/posttest.py @@ -0,0 +1,75 @@ +import requests +import json +print("begin") + + + +f1=open("database/switch_1688043588.json",'r',encoding='utf8') +j_ima=json.loads(f1.read()) + +f=open("NS_temp1.json",'r',encoding='utf8') +jsdata=json.loads(f.read()) +items=[] +for i in range(259): + jstemp={} + jstemp['platform']=jsdata[str(i)]['type'] + jstemp['SUK']=jsdata[str(i)]['SUK'] + jstemp['salestart']=jsdata[str(i)]['salestart'] + + jstemp['mainphoto']="images/"+j_ima['item_list'][i]['main_photo'] + + + i_name=[] + i_name_temp={} + if jsdata[str(i)]['ZH'] != " ": + i_name_temp['region']="ZH" + i_name_temp['name']=jsdata[str(i)]['ZH'] + i_name.append(i_name_temp) + i_name_temp={} + if jsdata[str(i)]['EN'] != " ": + i_name_temp['region']="EN" + i_name_temp['name']=jsdata[str(i)]['EN'] + i_name.append(i_name_temp) + i_name_temp={} + if jsdata[str(i)]['JP'] != " ": + i_name_temp['region']="JP" + i_name_temp['name']=jsdata[str(i)]['JP'] + i_name.append(i_name_temp) + i_name_temp={} + if "HK" in jsdata[str(i)]: + i_name_temp['region']="HK" + i_name_temp['name']=jsdata[str(i)]['HK'] + i_name.append(i_name_temp) + + bb=0 + cc={} + for aa in i_name: + cc[str(bb)]=aa + bb+=1 + jstemp['names']=json.dumps(i_name,ensure_ascii=False,) + + + i_tag=[] + if jsdata[str(i)]['TAG1'] != " ": + i_tag.append(jsdata[str(i)]['TAG1']) + if jsdata[str(i)]['TAG2'] != " ": + i_tag.append(jsdata[str(i)]['TAG2']) + if jsdata[str(i)]['TAG3'] != " ": + i_tag.append(jsdata[str(i)]['TAG3']) + + jstemp['tags']=json.dumps(i_tag,ensure_ascii=False) + items.append(jstemp) + +#print(items[0]) + +url='http://beta.lmve.net/index.php?app=pricetrend&ac=do&ts=add_item' + + +for i in items: + file={ + "mainphoto":open(i['mainphoto'],'rb') + } + r=requests.post(url,i,files=file) + if(r.status_code==200): + htmlx=r.text + print(htmlx) \ No newline at end of file