One line to login Zhihu by QRCode.
Project description
Zhihu QRCode Login
One line to login Zhihu by QRCode.
Usage
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('https://www.zhihu.com/collections/mine', headers=login_handler.get_visit_headers())
TODO
- Handle the condition that users scan the QRCode but cancel the login confirmation.
- Find more elegant approach to open and close the QRCode.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for Zhihu_QRCode_Login-0.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fa778890713cd9621a486423a204747377d79395544bab62729ce786b4a9a461 |
|
MD5 | 14be015ad17717954cc45f4633bab1aa |
|
BLAKE2b-256 | 976ded1d0018b7b746626818cbf4b8ae12f5f8b9d24085db347f20e71122a2b3 |