[错误记录]python requests库 Response 判断坑
2024-09-23 13:32:23
在requests访问之后, 我直接判断resp的值, 如下:
if resp:
do something
发现当Response 为500的时候没有进入if分支, 检查源码,发现Response重写了__bool__方法, 根据resp.raise_for_status来确定是否为True,
当为500时, 为假,
记录一下
最新文章
- idapython实现动态函数调用批量注释
- Python 小细节备忘
- Apache配置多域名 AH00548: NameVirtualHost has no effect and will be removed in the next release
- upgrade-php-5-1-to-php-5-3-using-yum-on-centos
- Linux System Reinforcement、Intrusion Detection Based On syslog
- Android-ImageView.ScaleType
- Oracle中NULL值与索引
- 数据库系统原理及其应用总结---ShinePans
- img标签中的src为php文件
- 异步编程和线程的使用(.NET 4.5 )
- json的引号之伤
- Win10问题汇总
- Windows下Oracle 11g安装以及创建数据库
- create-react-app入门教程
- DRF序列化/反序列化
- Link Cut Tree 总结
- Android系统自带样式(android:theme)
- Python的静态方法和类成员方法
- 20155236 2016-2017-2 《Java程序设计》第六周学习总结
- 《图解 HTTP 》阅读 —— 第五章
热门文章
- centos 6.5安装docker
- (在数据库中调用webservices。)SQL Server 阻止了对组件 'Ole Automation Procedures' 的 过程'sys.sp_OACreate' 的访问
- C# 枚举转字符串
- ubuntu上使用vim编辑文本内容
- 撩课-Web大前端每天5道面试题-Day19
- Form表单中Post与Get方法的区别
- Algorithm——两个排序数组的中位数
- JSP用户登录页面
- 破解 jeb 2.3.7 demo
- 网络 私有IP和子网掩码设置