Skip to main content

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

  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.

Source Distribution

Zhihu QRCode Login-0.0.2.tar.gz (4.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

Zhihu_QRCode_Login-0.0.2-py3-none-any.whl (6.6 kB view details)

Uploaded Python 3

File details

Details for the file Zhihu QRCode Login-0.0.2.tar.gz.

File metadata

  • Download URL: Zhihu QRCode Login-0.0.2.tar.gz
  • Upload date:
  • Size: 4.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.7.0

File hashes

Hashes for Zhihu QRCode Login-0.0.2.tar.gz
Algorithm Hash digest
SHA256 a516804f60e9134272ecf4f65b0800cf4cfdb424d485185a7de06bf8f9664aad
MD5 87e33f8212ddaa6d5556fe8d6db1b347
BLAKE2b-256 36398dd9ac04accb027397692bb1977bc37e9fcf00f0157650d99d7dff6b7c34

See more details on using hashes here.

File details

Details for the file Zhihu_QRCode_Login-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: Zhihu_QRCode_Login-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 6.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.7.0

File hashes

Hashes for Zhihu_QRCode_Login-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 fa778890713cd9621a486423a204747377d79395544bab62729ce786b4a9a461
MD5 14be015ad17717954cc45f4633bab1aa
BLAKE2b-256 976ded1d0018b7b746626818cbf4b8ae12f5f8b9d24085db347f20e71122a2b3

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page