Getting this to work with FastAPI or another Async Backend
未关闭
还没有人认领这个 Issue。
- 主要语言
- Python
- 星标
- 49
- 派生
- 36
- PR 合并指标
- 30 天内没有已合并 PR
描述
When attempting to do this in my FastAPI backend. I am noticing that the request is getting blocked.
handler = LogDNAHandler(key='')
logging.getLogger().addHandler(handler)
logging.info("Checking to see if it works!")
Looking at the library. I included the print "Request Sent". It never gets printed, the request does not execute, the backend sits there and I need to restart the entire app.
try:
headers = {
'user-agent': self.user_agent,
'apikey': self.key
}
response = requests.post(url=self.url,
json=data,
params={
'hostname': self.hostname,
'ip': self.ip,
'mac': self.mac,
'tags': self.tags,
'now': int(time.time() * 1000)
},
stream=True,
allow_redirects=True,
timeout=self.request_timeout,
headers=headers)
print("Request Sent")
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
首先复现 issue 中所示的 FastAPI 设置,并检查 requests.post 附近的 LogDNAHandler 路径。确认执行在哪里发生阻塞,并确定从异步后端进行日志记录时的预期行为;当请求完成且不会使后端挂起,并且可以观察到 handler 的请求路径时,即表示完成。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- fastapi, python
- 领域
- backend
- Issue 类型
- 缺陷
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 停滞
- 描述清晰度
- 需要澄清
- 新手友好度
- 35/100