【Hacker News搬运】Show HN:Httpdbg–一个跟踪Python代码发送的HTTP请求的工具
-
Title: Show HN: Httpdbg – A tool to trace the HTTP requests sent by your Python code
Show HN:Httpdbg–一个跟踪Python代码发送的HTTP请求的工具
Text: Hi,<p>I created httpdbg, a tool for Python developers to easily debug HTTP(S) client requests in Python programs.<p>I developed it because I needed a tool that could help me trace the HTTP requests sent by my tests back to the corresponding methods in our API client.<p>The goal of this tool is to simplify the debugging process, so I designed it to be as simple as possible. It requires no external dependencies, no setup, no superuser privileges, and no code modifications.<p>I'm sharing it with you today because I use it regularly, and it seems like others have found it useful too—so it might be helpful for you as well.<p>Hope you will like it.<p>cle<p>Source: <a href="https://github.com/cle-b/httpdbg">https://github.com/cle-b/httpdbg</a><p>Documentation: <a href="https://httpdbg.readthedocs.io/" rel="nofollow">https://httpdbg.readthedocs.io/</a><p>A blog post on a use case: <a href="https://medium.com/@cle-b/trace-all-your-http-requests-in-python-using-httpdbg-9db9110db981/" rel="nofollow">https://medium.com/@cle-b/trace-all-your-http-requests-in-py...</a>
嗨,<p>我创建了httpdbg,这是一个Python开发人员在Python程序中轻松调试HTTP(S)客户端请求的工具<p> 我开发它是因为我需要一个工具,可以帮助我将测试发送的HTTP请求追溯到API客户端中的相应方法<p> 此工具的目标是简化调试过程,因此我将其设计得尽可能简单。它不需要外部依赖,不需要设置,不需要超级用户权限,也不需要修改代码<p> 我;我今天和你分享它,因为我经常使用它,而且似乎其他人也发现它很有用——所以它可能对你也有帮助<p> 希望你会喜欢它。<p>cle<p>来源:<a href=“https:/;/ github.com&#cle-b/-httpdbg”>https:"/;github.com;cle-b;httpdbg</a><p>文档:<a href=“httpdbg.readthedocs.io”rel=“nofollow”>https://;httpdbg.readthedocs.io</a> <p>一篇关于用例的博客文章:<a href=“https:/;medium.com/@cle-b/-trace-all-your-http-requests-in-python-using-httpdbg-9db9110db981”rel=“nofollow”>https:/;media.com@cle-b;在py中跟踪所有http请求</a>
Url: https://github.com/cle-b/httpdbg
很抱歉,作为一个AI,我无法直接访问互联网或GitHub上的内容。但是,我可以根据您提供的链接描述来帮助您理解。 `httpdbg` 是一个 GitHub 上的开源项目,它可能是一个用于调试 HTTP 请求的工具或库。以下是关于这个项目可能的一些假设和解释: - **项目名称**:httpdbg - **项目类型**:可能是 Python 库或工具 - **功能**:该项目可能用于调试和分析 HTTP 请求,帮助开发者诊断和修复与 HTTP 相关的问题。 - **用途**:可能用于检查请求头、响应头、请求体和响应体,监控网络请求,或者在开发过程中进行性能测试。 - **特点**:可能包括日志记录、请求拦截、模拟和重放等功能。 如果您需要对这个项目有更深入的了解,以下是一些您可以采取的步骤: 1. **访问 GitHub 页面**:通过提供的链接访问 httpdbg 的 GitHub 页面。 2. **阅读 README 文件**:通常项目的 README 文件会包含项目的基本介绍、安装指南、使用方法等。 3. **查看文档**:如果项目提供了文档,您可以阅读文档来了解如何使用这个工具。 4. **查看源代码**:通过查看源代码,您可以了解项目的具体实现和功能。 5. **社区参与**:如果项目有活跃的社区,您可以通过 Issues、Pull Requests 等方式参与其中。 如果您需要将关于这个项目的英文内容翻译成中文,您可以提供具体的英文描述或段落,我可以帮您进行翻译。
Post by: cle-b
Comments:
dmurray: This looks great. I have a use case for something similar: detecting calls to the file system. Lots of code I've inherited has a habit of loading configuration from some random network share, then failing when that config got moved or the production host doesn't have the same access.<p>I usually use strace(1) to track these down, but it's nowhere near as ergonomic as this tool. I'm wondering now if I could patch the
open
built-in instead.dmurray: 这看起来很棒。我有一个类似的用例:检测对文件系统的调用。大量代码;ve继承的习惯是从一些随机的网络共享中加载配置,然后在配置被移动或生产主机没有移动时失败;我没有同样的权限<p> 我通常使用strace(1)来追踪这些,但它;它远不如这个工具符合人体工程学。我;我现在想知道我是否可以修补内置的“open”。
10000truths: Is there a way to write the trace to a file, instead of spinning up a local web server?
10000truths: 有没有一种方法可以将跟踪写入文件,而不是启动本地web服务器?
Jugurtha: That's pretty cool! I was playing last night and implemented resumable downloads[0] for pip so that it could pick up where it stopped upon a network disconnect or a user interruption. It sucks when large packages, especially ML related, fail at the last second and pip has to download from scratch. This tool would have been nice to have. Thanks a bunch,<p>- [0]: <a href="https://asciinema.org/a/1r8HmOLCfHm40nSvEZBqwm89k" rel="nofollow">https://asciinema.org/a/1r8HmOLCfHm40nSvEZBqwm89k</a>
Jugurtha: 那;太酷了!我昨晚在玩,为pip实现了可恢复下载[0],这样它就可以在网络断开或用户中断时从停止的地方继续下载。当大型软件包(尤其是与机器学习相关的软件包)在最后一秒失败,pip必须从头开始下载时,这很糟糕。如果有这个工具就好了。非常感谢,<p>-[0]:<a href=“https:/;asciinema.org./ 1r8HmOLCfHm40nSvEZBqwm89k”rel=“nofollow”>https:/;asciinema.org;a;1r8HmOLCfHm40nSvEZBqwm89k</a>
judofyr: Looks neat!<p>A similar tool for this would be VCR (originally built in Ruby, but ported to other languages since): <a href="https://vcrpy.readthedocs.io/en/latest/" rel="nofollow">https://vcrpy.readthedocs.io/en/latest/</a>. This injects itself into the request pipeline, records the result in a local file which can then also be replayed later in tests. It's a quite nice approach when you want to write tests (or just explore) a highly complicated HTTP API without actually hitting it all the time.
judofyr: 看起来很整洁<p> 一个类似的工具是VCR(最初是用Ruby构建的,但后来移植到其他语言):<A href=“https:/;vcrpy.readthedocs.io/ en latest";rel=“nofollow”>https:/;vcrpy.readthedocs.io;en■;最新</一这将自己注入请求管道,将结果记录在本地文件中,然后也可以在稍后的测试中重放。它;当您想要编写测试(或只是探索)一个高度复杂的HTTP API而不需要一直使用它时,这是一种非常好的方法。
accounter8or: I've always wanted this. You get so spoiled with the Chrome Dev Tools when using Javascript that you miss it when you don't have it.
accounter8or: 我;我一直想要这个。当你使用Javascript时,你会被Chrome开发工具宠坏,以至于当你不使用Javascript时就会错过它;我没有。