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
aa702429162
V2EX  ›  Python

Python 模拟登陆,发现是一个 js 文件 setcookies,而不是通过 post 页面返回设定 ck

  •  
  •   aa702429162 · May 13, 2019 · 2684 views
    This topic created in 2541 days ago, the information mentioned may be changed or developed.

    rt,login 地址是 http://shome.ouchn.cn ,js 地址是 http://pv.open.com.cn/datacollect.js 。 如何利用 py 模拟登陆最方便呢? js 看不懂,有木有大神解答一下

    6 replies    2019-05-14 17:01:06 +08:00
    frankyxu
        1
    frankyxu  
       May 13, 2019
    很简单啊,这个你用 requests 的 session 去请求,第一次请求验证码,第二个请求登录 api,最后把登陆成功后的 cookie 保存起来即可
    jalena
        2
    jalena  
       May 13, 2019
    @frankyxu 其实超简单,先这样,再这样,再这样,over~
    danmu17
        3
    danmu17  
       May 13, 2019
    会来这里问这种问题代表你需要的是无头浏览器。
    changwei
        4
    changwei  
       May 14, 2019
    chromedriver 这类库可以试试看
    lscho
        5
    lscho  
       May 14, 2019
    看了一下这个 js,和登录的 cookie 没有关系,是记录日志的。。就按 1 楼的就可以。
    zibber
        6
    zibber  
       May 14, 2019   ❤️ 1
    selenium 模拟点击
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1218 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 39ms · UTC 17:55 · PVG 01:55 · LAX 10:55 · JFK 13:55
    ♥ Do have faith in what you're doing.