Code Monkey home page Code Monkey logo

Comments (8)

tahitimoon avatar tahitimoon commented on June 8, 2024

如果项目部署在服务器上,想要录制我浏览器上的请求需要怎么配置呢? ip填服务器的ip, 端口填7778 ? 本地录制还是远端呢? 本地还会启动一个vpn 用于访问内网私有域名

ip填服务器的ip, 端口填7778,在远端录制,本地访问的流量走远端的服务器代理,现在我这边部署在云服务器体验有问题,可以自己部署在本地再试试,然后本地网络设置代理走ip 127.0.0.1 端口 7778

from lunarlink.

grassroadsZ avatar grassroadsZ commented on June 8, 2024

好的, 你服务器部署的好像7778 端口没开,我自己本地部署试一下吧

from lunarlink.

tahitimoon avatar tahitimoon commented on June 8, 2024

好的, 你服务器部署的好像7778 端口没开,我自己本地部署试一下吧

云服务器配置比较差就没开了

from lunarlink.

tahitimoon avatar tahitimoon commented on June 8, 2024

好的, 你服务器部署的好像7778 端口没开,我自己本地部署试一下吧

您是专门做量化交易的?

from lunarlink.

grassroadsZ avatar grassroadsZ commented on June 8, 2024

不是,和你是同行,之前研究过,韭菜一个,还在山顶上没下来呢

from lunarlink.

tahitimoon avatar tahitimoon commented on June 8, 2024

不是,和你是同行,之前研究过,韭菜一个,还在山顶上没下来呢

😂

from lunarlink.

grassroadsZ avatar grassroadsZ commented on June 8, 2024

流量录制生成测试用例失败:

curl 'http://127.0.0.1:8000/api/lunarlink/record_case' \
  -H 'sec-ch-ua: "Chromium";v="122", "Not(A:Brand";v="24", "Google Chrome";v="122"' \
  -H 'sec-ch-ua-mobile: ?0' \
  -H 'Authorization: eyJ0eXAiOiJKV1QiLCFkbWluQHFxLmNvbSIYONI' \
  -H 'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36' \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json, text/plain, */*' \
  -H 'Referer: http://127.0.0.1:8888/' \
  -H 'Project: 1' \
  -H 'sec-ch-ua-platform: "Windows"' \
  --data-raw '{"name":"3","length":1,"project":1,"case_dir":2,"api_dir":"","config":{"body":{"name":"chatbot-default","method":"config"}},"requests":[{"url":"https://baidu.com/userWebApi/user/userInfoDetail","body":"{\n    \"protalType\": 3\n}","request_method":"POST","request_headers":{"Host":"baidu.com","Connection":"keep-alive","Content-Length":"16","Pragma":"no-cache","Cache-Control":"no-cache","sec-ch-ua":"\"Chromium\";v=\"122\", \"Not(A:Brand\";v=\"24\", \"Google Chrome\";v=\"122\"","Content-Type":"application/json;charset=UTF-8","sec-ch-ua-mobile":"?0","User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36","token":"47a01c82-5b0d-469b-81be-7d2910da8b54","origin-cors":"5g","sec-ch-ua-platform":"\"Windows\"","Accept":"*/*","Origin":"https://baidu.com","Sec-Fetch-Site":"same-origin","Sec-Fetch-Mode":"cors","Sec-Fetch-Dest":"empty","Referer":"https://baidu.com/move-csp/home","Accept-Encoding":"gzip, deflate, br, zstd","Accept-Language":"zh-CN,zh;q=0.9,en;q=0.8","X-Forwarded-For":"127.0.0.1"},"response_headers":{"Server":"nginx","Date":"Fri, 29 Mar 2024 07:10:22 GMT","Content-Type":"application/json","Transfer-Encoding":"chunked","Connection":"keep-alive","Vary":"Accept-Encoding","Access-Control-Allow-Methods":"GET,POST","Access-Control-Max-Age":"3600","Access-control-Allow-Origin":"https://baidu.com","Content-Encoding":"gzip"},"cookies":{},"request_cookies":{},"response_content":"{\n    \"code\": 0,\n    \"data\": {\n        \"id\": 120,\n        \"userId\": \"2989827898\",\n        \"userName\": \"测试验证\",\n        \"phone\": \"18071531869\",\n        \"platformType\": null,\n        \"name\": \"测试验证\",\n        \"token\": \"47a01c82-5b0d-469b-81be-7d2910da8b54\",\n        \"mail\": \"[email protected]\",\n        \"emailActivated\": 0,\n        \"userImgUuid\": null,\n        \"userType\": 1,\n        \"personAuthStatus\": 3,\n        \"enterpriseAuthStatus\": 3,\n        \"authStatus\": 3,\n        \"registerTime\": \"2023-03-28T06:26:12.000+00:00\",\n        \"userStatus\": 1,\n        \"auditRemark\": \"\",\n        \"approvalStatus\": 3,\n        \"remark\": null,\n        \"certificateList\": [\n            \"10001\",\n            \"10002\",\n            \"10006\"\n        ],\n        \"permissions\": \"1,2\",\n        \"loginAddress\": null\n    },\n    \"msg\": null,\n    \"currentTime\": \"2024-03-29T07:10:22.995+00:00\",\n    \"traceId\": \"Ignored_Trace\"\n}","status_code":200,"id":2}]}'
2024-03-29 15:19:58,401 [4cfaf6037fb24ce5813c287e52f84188] django.request ERROR [pid:28296] [log.py->log_response:224] Internal Server Error: /api/lunarlink/record_case
Traceback (most recent call last):
File "E:\PythonCode\LunarLink\.venv\lib\site-packages\django\core\handlers\base.py", line 181, in _get_response
  response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "E:\PythonCode\LunarLink\.venv\lib\site-packages\django\views\decorators\csrf.py", line 54, in wrapped_view
  return view_func(*args, **kwargs)
File "E:\PythonCode\LunarLink\.venv\lib\site-packages\django\views\generic\base.py", line 70, in view
  return self.dispatch(request, *args, **kwargs)
File "E:\PythonCode\LunarLink\.venv\lib\site-packages\rest_framework\views.py", line 509, in dispatch
  response = self.handle_exception(exc)
File "E:\PythonCode\LunarLink\.venv\lib\site-packages\rest_framework\views.py", line 469, in handle_exception
  self.raise_uncaught_exception(exc)
File "E:\PythonCode\LunarLink\.venv\lib\site-packages\rest_framework\views.py", line 480, in raise_uncaught_exception
  raise exc
File "E:\PythonCode\LunarLink\.venv\lib\site-packages\rest_framework\views.py", line 506, in dispatch
  response = handler(request, *args, **kwargs)
File "E:\PythonCode\LunarLink\.venv\lib\site-packages\django\utils\decorators.py", line 43, in _wrapper
  return bound_method(*args, **kwargs)
File "E:\PythonCode\LunarLink\backend\apps\lunarlink\utils\decorator.py", line 38, in inner_wrapper
  return func(request, *args, **kwargs)
File "E:\PythonCode\LunarLink\backend\apps\lunarlink\views\suite.py", line 616, in post
  record_case, api_instances = CaseGenerator.generate_case(
File "E:\PythonCode\LunarLink\backend\apps\lunarlink\utils\request\generator.py", line 150, in generate_case
  CaseGenerator.append_extract(request_data, api_info_map, k, v, "form")
File "E:\PythonCode\LunarLink\backend\apps\lunarlink\utils\request\generator.py", line 251, in append_extract
  variables = CaseGenerator.extract_variables(item_value)
File "E:\PythonCode\LunarLink\backend\apps\lunarlink\utils\request\generator.py", line 87, in extract_variables
  matches = re.findall(r"\$http_res_(\d+)_(.*?)::(.+)", input_string)
File "C:\Users\issuser\AppData\Local\Programs\Python\Python39\lib\re.py", line 241, in findall
  return _compile(pattern, flags).findall(string)
TypeError: expected string or bytes-like object

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "E:\PythonCode\LunarLink\.venv\lib\site-packages\django\core\handlers\exception.py", line 47, in inner
  response = get_response(request)
File "E:\PythonCode\LunarLink\.venv\lib\site-packages\django\core\handlers\base.py", line 183, in _get_response
  response = self.process_exception_by_middleware(e, request)
File "E:\PythonCode\LunarLink\.venv\lib\site-packages\django\core\handlers\base.py", line 339, in process_exception_by_middleware
  response = middleware_method(request, exception)
File "E:\PythonCode\LunarLink\backend\backend\utils\middleware.py", line 121, in process_exception
  qy_message.send(msg=message_dict)
File "E:\PythonCode\LunarLink\backend\apps\lunarlink\utils\qy_message.py", line 67, in send
  res = requests.post(url=webhook, headers=header, json=data).json()
File "E:\PythonCode\LunarLink\.venv\lib\site-packages\requests\api.py", line 115, in post
  return request("post", url, data=data, json=json, **kwargs)
File "E:\PythonCode\LunarLink\.venv\lib\site-packages\requests\api.py", line 59, in request
  return session.request(method=method, url=url, **kwargs)
File "E:\PythonCode\LunarLink\.venv\lib\site-packages\requests\sessions.py", line 573, in request
  prep = self.prepare_request(req)
File "E:\PythonCode\LunarLink\.venv\lib\site-packages\requests\sessions.py", line 484, in prepare_request
  p.prepare(
File "E:\PythonCode\LunarLink\.venv\lib\site-packages\requests\models.py", line 368, in prepare
  self.prepare_url(url, params)
File "E:\PythonCode\LunarLink\.venv\lib\site-packages\requests\models.py", line 439, in prepare_url
  raise MissingSchema(
requests.exceptions.MissingSchema: Invalid URL '': No scheme supplied. Perhaps you meant https://?
2024-03-29 15:19:58,481 [4cfaf6037fb24ce5813c287e52f84188] django.server ERROR [pid:28296] [basehttp.py->log_message:161] "POST /api/lunarlink/record_case HTTP/1.1" 500 27940

不是很理解 generator 的151 行,json 的时候为什么还是form, debug 了一会没看出来问题, 上面是直接新建项目进行录制然后生成用例的报错, 看起来是在http_res 正则的时候出现了问题

from lunarlink.

tahitimoon avatar tahitimoon commented on June 8, 2024

流量录制生成测试用例失败:

curl 'http://127.0.0.1:8000/api/lunarlink/record_case' \
  -H 'sec-ch-ua: "Chromium";v="122", "Not(A:Brand";v="24", "Google Chrome";v="122"' \
  -H 'sec-ch-ua-mobile: ?0' \
  -H 'Authorization: eyJ0eXAiOiJKV1QiLCFkbWluQHFxLmNvbSIYONI' \
  -H 'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36' \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json, text/plain, */*' \
  -H 'Referer: http://127.0.0.1:8888/' \
  -H 'Project: 1' \
  -H 'sec-ch-ua-platform: "Windows"' \
  --data-raw '{"name":"3","length":1,"project":1,"case_dir":2,"api_dir":"","config":{"body":{"name":"chatbot-default","method":"config"}},"requests":[{"url":"https://baidu.com/userWebApi/user/userInfoDetail","body":"{\n    \"protalType\": 3\n}","request_method":"POST","request_headers":{"Host":"baidu.com","Connection":"keep-alive","Content-Length":"16","Pragma":"no-cache","Cache-Control":"no-cache","sec-ch-ua":"\"Chromium\";v=\"122\", \"Not(A:Brand\";v=\"24\", \"Google Chrome\";v=\"122\"","Content-Type":"application/json;charset=UTF-8","sec-ch-ua-mobile":"?0","User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36","token":"47a01c82-5b0d-469b-81be-7d2910da8b54","origin-cors":"5g","sec-ch-ua-platform":"\"Windows\"","Accept":"*/*","Origin":"https://baidu.com","Sec-Fetch-Site":"same-origin","Sec-Fetch-Mode":"cors","Sec-Fetch-Dest":"empty","Referer":"https://baidu.com/move-csp/home","Accept-Encoding":"gzip, deflate, br, zstd","Accept-Language":"zh-CN,zh;q=0.9,en;q=0.8","X-Forwarded-For":"127.0.0.1"},"response_headers":{"Server":"nginx","Date":"Fri, 29 Mar 2024 07:10:22 GMT","Content-Type":"application/json","Transfer-Encoding":"chunked","Connection":"keep-alive","Vary":"Accept-Encoding","Access-Control-Allow-Methods":"GET,POST","Access-Control-Max-Age":"3600","Access-control-Allow-Origin":"https://baidu.com","Content-Encoding":"gzip"},"cookies":{},"request_cookies":{},"response_content":"{\n    \"code\": 0,\n    \"data\": {\n        \"id\": 120,\n        \"userId\": \"2989827898\",\n        \"userName\": \"测试验证\",\n        \"phone\": \"18071531869\",\n        \"platformType\": null,\n        \"name\": \"测试验证\",\n        \"token\": \"47a01c82-5b0d-469b-81be-7d2910da8b54\",\n        \"mail\": \"[email protected]\",\n        \"emailActivated\": 0,\n        \"userImgUuid\": null,\n        \"userType\": 1,\n        \"personAuthStatus\": 3,\n        \"enterpriseAuthStatus\": 3,\n        \"authStatus\": 3,\n        \"registerTime\": \"2023-03-28T06:26:12.000+00:00\",\n        \"userStatus\": 1,\n        \"auditRemark\": \"\",\n        \"approvalStatus\": 3,\n        \"remark\": null,\n        \"certificateList\": [\n            \"10001\",\n            \"10002\",\n            \"10006\"\n        ],\n        \"permissions\": \"1,2\",\n        \"loginAddress\": null\n    },\n    \"msg\": null,\n    \"currentTime\": \"2024-03-29T07:10:22.995+00:00\",\n    \"traceId\": \"Ignored_Trace\"\n}","status_code":200,"id":2}]}'
2024-03-29 15:19:58,401 [4cfaf6037fb24ce5813c287e52f84188] django.request ERROR [pid:28296] [log.py->log_response:224] Internal Server Error: /api/lunarlink/record_case
Traceback (most recent call last):
File "E:\PythonCode\LunarLink\.venv\lib\site-packages\django\core\handlers\base.py", line 181, in _get_response
  response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "E:\PythonCode\LunarLink\.venv\lib\site-packages\django\views\decorators\csrf.py", line 54, in wrapped_view
  return view_func(*args, **kwargs)
File "E:\PythonCode\LunarLink\.venv\lib\site-packages\django\views\generic\base.py", line 70, in view
  return self.dispatch(request, *args, **kwargs)
File "E:\PythonCode\LunarLink\.venv\lib\site-packages\rest_framework\views.py", line 509, in dispatch
  response = self.handle_exception(exc)
File "E:\PythonCode\LunarLink\.venv\lib\site-packages\rest_framework\views.py", line 469, in handle_exception
  self.raise_uncaught_exception(exc)
File "E:\PythonCode\LunarLink\.venv\lib\site-packages\rest_framework\views.py", line 480, in raise_uncaught_exception
  raise exc
File "E:\PythonCode\LunarLink\.venv\lib\site-packages\rest_framework\views.py", line 506, in dispatch
  response = handler(request, *args, **kwargs)
File "E:\PythonCode\LunarLink\.venv\lib\site-packages\django\utils\decorators.py", line 43, in _wrapper
  return bound_method(*args, **kwargs)
File "E:\PythonCode\LunarLink\backend\apps\lunarlink\utils\decorator.py", line 38, in inner_wrapper
  return func(request, *args, **kwargs)
File "E:\PythonCode\LunarLink\backend\apps\lunarlink\views\suite.py", line 616, in post
  record_case, api_instances = CaseGenerator.generate_case(
File "E:\PythonCode\LunarLink\backend\apps\lunarlink\utils\request\generator.py", line 150, in generate_case
  CaseGenerator.append_extract(request_data, api_info_map, k, v, "form")
File "E:\PythonCode\LunarLink\backend\apps\lunarlink\utils\request\generator.py", line 251, in append_extract
  variables = CaseGenerator.extract_variables(item_value)
File "E:\PythonCode\LunarLink\backend\apps\lunarlink\utils\request\generator.py", line 87, in extract_variables
  matches = re.findall(r"\$http_res_(\d+)_(.*?)::(.+)", input_string)
File "C:\Users\issuser\AppData\Local\Programs\Python\Python39\lib\re.py", line 241, in findall
  return _compile(pattern, flags).findall(string)
TypeError: expected string or bytes-like object

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "E:\PythonCode\LunarLink\.venv\lib\site-packages\django\core\handlers\exception.py", line 47, in inner
  response = get_response(request)
File "E:\PythonCode\LunarLink\.venv\lib\site-packages\django\core\handlers\base.py", line 183, in _get_response
  response = self.process_exception_by_middleware(e, request)
File "E:\PythonCode\LunarLink\.venv\lib\site-packages\django\core\handlers\base.py", line 339, in process_exception_by_middleware
  response = middleware_method(request, exception)
File "E:\PythonCode\LunarLink\backend\backend\utils\middleware.py", line 121, in process_exception
  qy_message.send(msg=message_dict)
File "E:\PythonCode\LunarLink\backend\apps\lunarlink\utils\qy_message.py", line 67, in send
  res = requests.post(url=webhook, headers=header, json=data).json()
File "E:\PythonCode\LunarLink\.venv\lib\site-packages\requests\api.py", line 115, in post
  return request("post", url, data=data, json=json, **kwargs)
File "E:\PythonCode\LunarLink\.venv\lib\site-packages\requests\api.py", line 59, in request
  return session.request(method=method, url=url, **kwargs)
File "E:\PythonCode\LunarLink\.venv\lib\site-packages\requests\sessions.py", line 573, in request
  prep = self.prepare_request(req)
File "E:\PythonCode\LunarLink\.venv\lib\site-packages\requests\sessions.py", line 484, in prepare_request
  p.prepare(
File "E:\PythonCode\LunarLink\.venv\lib\site-packages\requests\models.py", line 368, in prepare
  self.prepare_url(url, params)
File "E:\PythonCode\LunarLink\.venv\lib\site-packages\requests\models.py", line 439, in prepare_url
  raise MissingSchema(
requests.exceptions.MissingSchema: Invalid URL '': No scheme supplied. Perhaps you meant https://?
2024-03-29 15:19:58,481 [4cfaf6037fb24ce5813c287e52f84188] django.server ERROR [pid:28296] [basehttp.py->log_message:161] "POST /api/lunarlink/record_case HTTP/1.1" 500 27940

不是很理解 generator 的151 行,json 的时候为什么还是form, debug 了一会没看出来问题, 上面是直接新建项目进行录制然后生成用例的报错, 看起来是在http_res 正则的时候出现了问题

克隆最新代码试试,已经修复了这个问题

from lunarlink.

Related Issues (15)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.