V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
beforeuwait
V2EX  ›  Python

请教一个爬虫关于 HTTPS 请求的问题

  •  
  •   beforeuwait ·
    beforeuwait · Oct 11, 2018 · 3236 views
    This topic created in 2768 days ago, the information mentioned may be changed or developed.

    笔者在 app 抓包的时候发现问题。

    我用的 charles

    比如抓包美团,手机配置代理后,美团就请求不到数据。

    后来 google 后知道人家用了 ssl,这个证书在 charles 的 ca 里没有,所以通不过。

    嗯,好吧,那就常规的 app,charles 可以抓包

    我在写爬虫时候,根据抓包的 url cookie header 就可以去请求数据了。

    这里我就突然困惑了,即使可以抓包,也是因为安装了 ca,而我在用 requests 库时候,并没有带任何证书,服务器仍旧会给我反馈,那么在爬虫层面 http 和 https 就没有区别了

    这是为什么呢?

    3 replies    2018-10-11 19:41:40 +08:00
    beforeuwait
        1
    beforeuwait  
    OP
       Oct 11, 2018
    手动捂脸
    刚刚我想明白了
    平时我一直用的代理
    偶尔用本地 ip 去请求是时候会 SSL 报错
    requests 这个库去进行 https 请求也需要带 ca 的
    liuyanjun0826
        2
    liuyanjun0826  
       Oct 11, 2018 via Android
    你好像对 hash 有所误解
    daiqiangbudainiu
        3
    daiqiangbudainiu  
       Oct 11, 2018   ❤️ 2
    我觉得你应该先搞清楚 http 和 https,然后了解一下 MITM,然后了解一下 ssl pinning
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   6189 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 36ms · UTC 02:34 · PVG 10:34 · LAX 19:34 · JFK 22:34
    ♥ Do have faith in what you're doing.