Skip to main content

One line to login Zhihu by QRCode.

Project description

Zhihu QRCode Login

One line to login Zhihu by QRCode.


from zhihu_qrcode_login import login_handler
import logging

# if remember_me = True, the cookies will be saved in your disk, 
# and next time you can login without scanning QRCode.
# if you pass a logger into it, it can output some useful log.
# return requests.Session
logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(name)s - %(levelname)s - %(message)s')
logger = logging.getLogger('test')
session = login_handler.login(remember_me=True, logger=logger)
# and later you can also use get_session() to get the session.
# session = login_handler.get_session()

# use it!
# you can use get_visit_headers() to get the headers which can visit Zhihu successfully.
session.get('', headers=login_handler.get_visit_headers())


  1. Handle the condition that users scan the QRCode but cancel the login confirmation.
  2. Find more elegant approach to open and close the QRCode.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for Zhihu-QRCode-Login, version 0.0.2
Filename, size File type Python version Upload date Hashes
Filename, size Zhihu_QRCode_Login-0.0.2-py3-none-any.whl (6.6 kB) File type Wheel Python version py3 Upload date Hashes View hashes
Filename, size Zhihu QRCode Login-0.0.2.tar.gz (4.8 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page