推荐学习书目
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
NaVient
V2EX  ›  Python

关于网站登录状态的一点小问题

  •  
  •   NaVient · Nov 28, 2016 · 2288 views
    This topic created in 3497 days ago, the information mentioned may be changed or developed.

    最近写爬虫,遇到一个网站,会定时清掉我的登录状态。我想知道我怎样才能判断自己是否有登录。 现在我采取的办法是有一些页面元素里未登录的话有 ihide ,我是通过判断是否有 ihide 这个 class 来判断是否登录的。 我想知道能不能通过 cookie 或者 session 来判断,感觉这样稳妥点?

    3 replies    2016-11-29 09:09:06 +08:00
    qiukong
        1
    qiukong  
       Nov 28, 2016
    别人家的网站 session 你能判断的了?
    只能试试 cookie 吧,有效期啥的,或者被踢出后的 cookie 变动。
    zmrenwu
        2
    zmrenwu  
       Nov 28, 2016
    如果没有登录网站会重定向你到登录页的话,可以通过返回状态码判断。
    rogwan
        3
    rogwan  
       Nov 29, 2016 via Android
    @qiukong cookie 有效期的数据也能读的出来吗?
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   908 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 32ms · UTC 19:29 · PVG 03:29 · LAX 12:29 · JFK 15:29
    ♥ Do have faith in what you're doing.