python 进程已完成,退出代码为245

6jygbczu  于 2024-01-05  发布在  Python
关注(0)|答案(1)|浏览(178)

Ubuntu 18.04
简体中文
中文(简体)
堆栈跟踪:

  1. pydev debugger: process 20074 is connecting
  2. Watching for file changes with StatReloader
  3. Performing system checks...
  4. System check identified no issues (0 silenced).
  5. August 31, 2019 - 14:28:33
  6. Django version 2.2.3, using settings 'ads_manager.settings'
  7. Starting development server at http://127.0.0.1:8000/
  8. Quit the server with CONTROL-C.
  9. Not Found: /]
  10. [31/Aug/2019 14:30:22] "GET /] HTTP/1.1" 404 9405
  11. [31/Aug/2019 14:30:24] "GET / HTTP/1.1" 200 4908
  12. [31/Aug/2019 14:30:24] "GET /static/main.css HTTP/1.1" 304 0
  13. /home/michael/PycharmProjects/ads1/venv/lib/python3.7/site-packages/urllib3/connectionpool.py:851: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
  14. InsecureRequestWarning)
  15. /home/michael/PycharmProjects/ads1/venv/lib/python3.7/site-packages/urllib3/connectionpool.py:851: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
  16. InsecureRequestWarning)
  17. /home/michael/PycharmProjects/ads1/venv/lib/python3.7/site-packages/urllib3/connectionpool.py:851: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
  18. InsecureRequestWarning)
  19. /home/michael/PycharmProjects/ads1/venv/lib/python3.7/site-packages/urllib3/connectionpool.py:851: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
  20. InsecureRequestWarning)
  21. /home/michael/PycharmProjects/ads1/venv/lib/python3.7/site-packages/urllib3/connectionpool.py:851: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
  22. InsecureRequestWarning)
  23. /home/michael/PycharmProjects/ads1/venv/lib/python3.7/site-packages/urllib3/connectionpool.py:851: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
  24. InsecureRequestWarning)
  25. /home/michael/PycharmProjects/ads1/venv/lib/python3.7/site-packages/urllib3/connectionpool.py:851: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
  26. InsecureRequestWarning)
  27. /home/michael/PycharmProjects/ads1/venv/lib/python3.7/site-packages/urllib3/connectionpool.py:851: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
  28. InsecureRequestWarning)
  29. /home/michael/PycharmProjects/ads1/venv/lib/python3.7/site-packages/urllib3/connectionpool.py:851: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
  30. InsecureRequestWarning)
  31. /home/michael/PycharmProjects/ads1/venv/lib/python3.7/site-packages/urllib3/connectionpool.py:851: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
  32. InsecureRequestWarning)
  33. /home/michael/PycharmProjects/ads1/venv/lib/python3.7/site-packages/urllib3/connectionpool.py:851: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
  34. InsecureRequestWarning)
  35. /home/michael/PycharmProjects/ads1/venv/lib/python3.7/site-packages/urllib3/connectionpool.py:851: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
  36. InsecureRequestWarning)
  37. /home/michael/PycharmProjects/ads1/venv/lib/python3.7/site-packages/urllib3/connectionpool.py:851: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
  38. InsecureRequestWarning)
  39. /home/michael/PycharmProjects/ads1/venv/lib/python3.7/site-packages/urllib3/connectionpool.py:851: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
  40. InsecureRequestWarning)
  41. /home/michael/PycharmProjects/ads1/venv/lib/python3.7/site-packages/urllib3/connectionpool.py:851: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
  42. InsecureRequestWarning)
  43. /home/michael/PycharmProjects/ads1/venv/lib/python3.7/site-packages/urllib3/connectionpool.py:851: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
  44. InsecureRequestWarning)
  45. Process finished with exit code 245

字符串
在一个循环中发出了几个http请求。换句话说,这个函数被调用了几次:

  1. import requests
  2. def execute_request(ad_entity, data, url=None):
  3. data_bytes = json.dumps(data, ensure_ascii=False).encode("utf-8")
  4. headers = get_headers()
  5. URL = url or '{}{}/'.format(API_ADDRESS, ad_entity.value.lower())
  6. response = requests.post(URL, headers=headers, data=data_bytes,
  7. verify=False)


这个问题似乎与python本身的线程安全有关。它似乎与Django无关。我试图通过在请求之间增加2秒的睡眠来解决它。据我所知,它没有帮助。
你能不能给予我一个建议:1.这段代码是什么意思,在哪里可以读到它?2.这个问题有什么解决方案吗?3.我能打开一个更详细的日志记录或在某个地方找到一个更深入的日志吗?4.无论如何,如何定位这个问题?

vjrehmav

vjrehmav1#

这些警告来自urllib3模块,原因是HTTPS证书验证被禁用。
负责修复的部分是verify=False,只需将其删除或替换为verify=True(默认)即可。
另一种抑制警告的方法(* 强烈不推荐 *)是在导入请求之前添加以下内容:

  1. import urllib3
  2. urllib3.disable_warnings()

字符串

相关问题