数数虚拟维度表导入脚本
This commit is contained in:
parent
fa68e5ff77
commit
657578c3ff
@ -4,7 +4,7 @@ import requests
|
||||
import sys
|
||||
from urllib.parse import unquote, quote, urlencode
|
||||
import pdb
|
||||
|
||||
import subprocess
|
||||
|
||||
def my_quote(data):
|
||||
if isinstance(data, dict):
|
||||
@ -15,11 +15,11 @@ def my_quote(data):
|
||||
|
||||
class SS_Virtual_command:
|
||||
def __init__(self):
|
||||
self.ss_virtual_url = "https://10.10.3.17:8992/v1/ta/meta/prop/virtual/dict/create"
|
||||
self.ss_virtual_url = "http://10.10.3.14:8993/v1/ta/meta/prop/virtual/dict/create"
|
||||
self.method = "post"
|
||||
|
||||
|
||||
def upload(self, filename):
|
||||
def upload_gameid(self, filename):
|
||||
|
||||
projectId = int(19)
|
||||
createParam = {"commonHeader": {"projectId": 19},
|
||||
@ -28,12 +28,23 @@ class SS_Virtual_command:
|
||||
{"property": {"columnName": "gameid_china", "columnDesc": "china映射", "selectType": "string"}}]}
|
||||
loginName = "root"
|
||||
password = "kingsome2016"
|
||||
pdb.set_trace()
|
||||
body = {"projectId": projectId, "createParam": createParam, "loginName": loginName, "password": password}
|
||||
quote_body = my_quote(body)
|
||||
|
||||
cmd = f"curl --header 'Accept: application/json' --form 'file=@{filename}' {self.ss_virtual_url}?{quote_body}"
|
||||
print(cmd)
|
||||
cmdref = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
|
||||
output, error_info = cmdref.communicate()
|
||||
if cmdref.returncode != 0:
|
||||
if isinstance(error_info, list) or isinstance(error_info, tuple):
|
||||
error_info = error_info[0]
|
||||
msg = "RUN %s ERROR,error info: %s" % (cmd, error_info)
|
||||
print(f"{msg},error info={error_info}")
|
||||
return False
|
||||
else:
|
||||
print("Run Success")
|
||||
return True
|
||||
|
||||
# r = requests.post(url=self.ss_virtual_url, header="Accept: application/json", files=filename, data=quote_body)
|
||||
# if r.status_code == requests.codes.ok:
|
||||
# print(f"upload success,return={r.content}")
|
||||
@ -49,7 +60,7 @@ def main():
|
||||
|
||||
filename = sys.argv[1]
|
||||
ss = SS_Virtual_command()
|
||||
ss.upload(filename)
|
||||
ss.upload_gameid(filename)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
Loading…
x
Reference in New Issue
Block a user