自动化接口自定义脚本post数据过多导致无法发送请求

candidate_total大于300无法发送请求

eg:

直接外呼3000人脚本
log.info("make_direct_calls test start")
import time
import httplib
import json
import random
 
 
candidate_total = 3001
timeout = 10000000
 
start_ts = time.time()
 
access_token = vars.get("access_token")
timestamp = vars.get("timestamp")
signature = vars.get("signature")
curr_now = vars.get("curr_now")
 
section_no = 145
 
params = {
  "candidates": [
    {
      "candidate_phone""{}{}".format(section_no, random.randint(1000000099999999)),
      "candidate_name""赵{}".format(i),
      "position""xxxx",
      "candidate_email""{}@moseeker.com".format(random.randint(1000000099999999))
    for in range(candidate_total)
  ],
  "signature": signature,
  "call_time": curr_now,
  "script_id"234,
  "timestamp": timestamp
}
 
 
params = json.dumps(params)
 
# log.info(params)
 
headers = {'Content-Type''application/json'"Authorization""{}".format(access_token)}
host = 'moagentopenapi-t.dqprism.com'
path = '/api/call/make_direct_calls'
method = 'POST'
 
conn = httplib.HTTPSConnection(host)
conn.request(method, path, params, headers)
conn.sock.settimeout(timeout)
data = conn.getresponse().read()
# log.info(data)
end_ts = time.time()
 
log.info("total cost:{}s".format(round(end_ts-start_ts, 3)))
data = json.loads(data)
log.info("make_direct_calls test end")

 

错误日志:

2022-02-25 14:45:44 INFO StandardJMeterEngine Running the test!
2022-02-25 14:45:44 INFO StandardJMeterEngine List of sample_variables: []
2022-02-25 14:45:46 INFO StandardJMeterEngine Starting ThreadGroup: 1 : 6095a0a9
2022-02-25 14:45:46 INFO StandardJMeterEngine Starting 1 threads for group 6095a0a9.
2022-02-25 14:45:46 INFO StandardJMeterEngine Thread will continue on error
2022-02-25 14:45:46 INFO StandardJMeterEngine Starting thread group... number=1 threads=1 ramp-up=1 delayedStart=false
2022-02-25 14:45:46 INFO StandardJMeterEngine Started thread group number 1
2022-02-25 14:45:46 INFO StandardJMeterEngine All thread groups have been started
2022-02-25 14:45:46 INFO 6095a0a9 1-1 Thread started: 6095a0a9 1-1
2022-02-25 14:45:46 INFO 6095a0a9 1-1 autotest before handle start
2022-02-25 14:45:47 INFO 6095a0a9 1-1 {"app_id": "2aef90ba", "app_secret": "098b797c7e094ef58f476bf9e04c8e3e"}
2022-02-25 14:45:47 INFO 6095a0a9 1-1 {"data":{"access_token":"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJhcHBfaWQiOiIyYWVmOTBiYSIsImV4cCI6MTY0NTc3ODc0NywiaWF0IjoxNjQ1NzcxNTQ3LCJjb21wYW55X2lkIjozOTk3OCwiaHJfaWQiOjEwMDAzNzJ9.MBWtVj4cYJSakfDC4zOzStWDE1uQFeTrhpP50suF7Ic"},"message":"success","status":0}
2022-02-25 14:45:47 INFO 6095a0a9 1-1 signature:5101b88d34ebe34a4b282e54fed97d9a ts:1645771547
2022-02-25 14:45:47 INFO 6095a0a9 1-1 2022-02-25 14:45:47
2022-02-25 14:45:47 INFO 6095a0a9 1-1 e1dbaf15271b42efbea63cc18eeb50fd
2022-02-25 14:45:47 INFO 6095a0a9 1-1 autotest before handle end
2022-02-25 14:45:47 INFO 6095a0a9 1-1 Stored: /opt/metersphere/data/body/e26e682b-0dd_mobile500.csv Alias: /opt/metersphere/data/body/e26e682b-0dd_mobile500.csv@1039858559
2022-02-25 14:45:47 INFO 6095a0a9 1-1 make_direct_calls test start
2022-02-25 14:46:38 ERROR 6095a0a9 1-1 Problem in JSR223 script 3001人直接外呼, message: {}
httplib.BadStatusLine: '' in <script> at line number 48
javax.script.ScriptException
at org.python.jsr223.PyScriptEngine.scriptException(PyScriptEngine.java:222)
at org.python.jsr223.PyScriptEngine.eval(PyScriptEngine.java:59)
at org.python.jsr223.PyScriptEngine.access$300(PyScriptEngine.java:20)
at org.python.jsr223.PyScriptEngine$PyCompiledScript.eval(PyScriptEngine.java:250)
at javax.script.CompiledScript.eval(CompiledScript.java:92)
at org.apache.jmeter.util.JSR223TestElement.processFileOrScript(JSR223TestElement.java:258)
at org.apache.jmeter.protocol.java.sampler.JSR223Sampler.sample(JSR223Sampler.java:72)
at org.apache.jmeter.threads.JMeterThread.doSampling(JMeterThread.java:652)
at org.apache.jmeter.threads.JMeterThread.executeSamplePackage(JMeterThread.java:571)
at org.apache.jmeter.threads.JMeterThread.processSampler(JMeterThread.java:486)
at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:250)
at java.lang.Thread.run(Thread.java:748)
2022-02-25 14:46:39 INFO 6095a0a9 1-1 Thread is done: 6095a0a9 1-1
2022-02-25 14:46:39 INFO 6095a0a9 1-1 Thread finished: 6095a0a9 1-1
2022-02-25 14:46:39 INFO StandardJMeterEngine Notifying test listeners of end of test

posted @   恩艾  阅读(223)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 25岁的心里话
· 闲置电脑爆改个人服务器(超详细) #公网映射 #Vmware虚拟网络编辑器
· 零经验选手,Compose 一天开发一款小游戏!
· 通过 API 将Deepseek响应流式内容输出到前端
· 因为Apifox不支持离线,我果断选择了Apipost!
点击右上角即可分享
微信分享提示