python - 如何在 Python 中模拟请求的响应
问题描述
下面是代码:
response = requests.get("xyx@.com", stream=True)
data = response.raw.read()
我想模拟“response.raw.read()”,我知道模拟 requests.get 的几个选项,但我需要模拟第二行代码。
解决方案
推荐阅读
- dns - 将合成记录动态分配给 Google Domain
- android - 查找 String[] 是否在 Room 数据库 Android 中包含字符串
- php - Laravel 无法使用模拟的服务和对象测试作业。Mockery 间谍无法检测到被调用的方法
- macos - MacOS 无线诊断 802.11 报告
- php - Laravel 存储库模式 - 关系错误
- azure - 如何使用 Azure 集成运行时设置 Azure 数据工厂的高可用性?
- android - Play Billing - 实施应用内购买以解锁内容并移除广告
- javascript - 反应原生:有办法显示 Ionicon 吗?
- error-handling - 令牌过期时在graphQL客户端中使用刷新令牌
- c++ - 使用复制赋值构造函数和迭代元素来修改 Mat 之间是否存在显着的性能差异?