MCPcopy Create free account
hub / github.com/aaPanel/BaoTa / HttpPost

Method HttpPost

script/task_script_extension.py:400–417  ·  view source on GitHub ↗
(self, url, data, timeout=6, UserAgent='BT-Panel')

Source from the content-addressed store, hash-verified

398 return ":".join([mac[e:e + 2] for e in range(0, 11, 2)])
399
400 def HttpPost(self, url, data, timeout=6, UserAgent='BT-Panel'):
401 try:
402 pdata = ""
403 if type(data) == dict:
404 for key in data:
405 pdata += "{}={}&".format(key, data[key])
406 pdata = pdata.strip('&')
407 else:
408 pdata = data
409 curl_cmd = "curl -sS --connect-timeout {} --max-time {} --user-agent '{}' -d '{}' '{}'".format(timeout, timeout, UserAgent, pdata, url)
410
411 result = public.ExecShell(curl_cmd)
412 if result[1]:
413 self.write_log("httpPost:", result[1])
414 return result[0]
415 except Exception as ex:
416 self.write_log("URL: {} => {}".format(url, ex))
417 return str(ex)
418
419 def maillog_event_service(self):
420 # 判断是否已安装企业版邮局

Callers 10

get_cloud_list_statusMethod · 0.95
GetSSLMethod · 0.80
create_activity_orderMethod · 0.80
apple_betaMethod · 0.80
to_not_betaMethod · 0.80
to_betaMethod · 0.80
check_user_authMethod · 0.80
get_cloud_list_statusMethod · 0.80
is_verify_unbindingMethod · 0.80

Calls 3

write_logMethod · 0.95
ExecShellMethod · 0.80
formatMethod · 0.45

Tested by

no test coverage detected