pywe-ticket
Wechat Ticket Module for Python.
Installation
pip install pywe-ticket
Usage
MemoryStorage:
Ticket::
# Sandbox: http://mp.weixin.qq.com/debug/cgi-bin/sandbox?t=sandbox/login
In [1]: from pywe_ticket import Ticket
In [2]: ticket = Ticket('wx7aad305aed68bfe3', '9eac636765940ec286055c559ff84039')
In [3]: ticket.
ticket.API_DOMAIN ticket.WECHAT_TICKET ticket.expires_at ticket.refresh_ticket ticket.ticket ticket.type
ticket.MCH_DOMAIN ticket.api_ticket ticket.get ticket.secret ticket.ticket_info_key
ticket.OPEN_DOMAIN ticket.appid ticket.jsapi_ticket ticket.storage ticket.tickets
In [3]: ticket.ticket()
Out[3]: u'sM4AOVdWfPE4DxkXGEs8VB_Ml7aLXlo2_KgFGduwNU6irBzC2ySEv3Ofex5q2eY1C50R-GffnrsRWFI7uDim9g'
In [4]: ticket.jsapi_ticket()
Out[4]: u'sM4AOVdWfPE4DxkXGEs8VB_Ml7aLXlo2_KgFGduwNU6irBzC2ySEv3Ofex5q2eY1C50R-GffnrsRWFI7uDim9g'
In [5]: ticket.api_ticket()
Out[5]: u'E0o2-at6NcC2OsJiQTlwlEaNeSfCJatHbnTsr44R0i4GASKTn-ZELWB3Oe7cpRbg5bLf4ZD5Ylg5cuOqma8LxA'
ticket::
In [1]: from pywe_ticket import ticket, api_ticket, jsapi_ticket
In [2]: ticket('wx7aad305aed68bfe3', '9eac636765940ec286055c559ff84039')
Out[2]: u'sM4AOVdWfPE4DxkXGEs8VB_Ml7aLXlo2_KgFGduwNU6irBzC2ySEv3Ofex5q2eY1C50R-GffnrsRWFI7uDim9g'
In [3]: api_ticket('wx7aad305aed68bfe3', '9eac636765940ec286055c559ff84039')
Out[3]: u'E0o2-at6NcC2OsJiQTlwlEaNeSfCJatHbnTsr44R0i4GASKTn-ZELWB3Oe7cpRbg5bLf4ZD5Ylg5cuOqma8LxA'
In [4]: jsapi_ticket('wx7aad305aed68bfe3', '9eac636765940ec286055c559ff84039')
Out[4]: u'sM4AOVdWfPE4DxkXGEs8VB_Ml7aLXlo2_KgFGduwNU6irBzC2ySEv3Ofex5q2eY1C50R-GffnrsRWFI7uDim9g'
RedisStorage:
Ticket::
In [1]: import redis_extensions as redis
In [2]: r = redis.StrictRedisExtensions(host='localhost', port=6379, db=0)
In [3]: from pywe_storage import RedisStorage
In [4]: storage = RedisStorage(r)
In [5]: from pywe_ticket import Ticket
In [6]: ticket = Ticket('wx7aad305aed68bfe3', '9eac636765940ec286055c559ff84039', storage=storage)
In [7]: ticket.ticket()
Out[7]: u'sM4AOVdWfPE4DxkXGEs8VB_Ml7aLXlo2_KgFGduwNU6-KN0maRl2mp5Gn8-ah5WDDphfA-zyZ4AfBb3Q13O8LA'
In [8]: r.get('pywe:wx7aad305aed68bfe3:jsapi:ticket:info')
Out[8]: '{"ticket": "sM4AOVdWfPE4DxkXGEs8VB_Ml7aLXlo2_KgFGduwNU6-KN0maRl2mp5Gn8-ah5WDDphfA-zyZ4AfBb3Q13O8LA", "expires_at": 1499767753, "expires_in": 7200, "errcode": 0, "errmsg": "ok"}'
ticket::
In [1]: import redis_extensions as redis
In [2]: r = redis.StrictRedisExtensions(host='localhost', port=6379, db=0)
In [3]: from pywe_storage import RedisStorage
In [4]: storage = RedisStorage(r)
In [5]: from pywe_ticket import ticket
In [6]: ticket('wx7aad305aed68bfe3', '9eac636765940ec286055c559ff84039', storage=storage)
Out[6]: u'sM4AOVdWfPE4DxkXGEs8VB_Ml7aLXlo2_KgFGduwNU6-KN0maRl2mp5Gn8-ah5WDDphfA-zyZ4AfBb3Q13O8LA'
In [7]: r.get('pywe:wx7aad305aed68bfe3:jsapi:ticket:info')
Out[7]: '{"ticket": "sM4AOVdWfPE4DxkXGEs8VB_Ml7aLXlo2_KgFGduwNU6-KN0maRl2mp5Gn8-ah5WDDphfA-zyZ4AfBb3Q13O8LA", "expires_at": 1499767753, "expires_in": 7200, "errcode": 0, "errmsg": "ok"}'
Method
class Ticket(BaseWechat):
def __init__(self, appid=None, secret=None, type='jsapi', storage=None, token_fetched_func=None):
def ticket(self, appid=None, secret=None, token=None, type='jsapi', storage=None, token_fetched_func=None):
def api_ticket(self, appid=None, secret=None, token=None, storage=None, token_fetched_func=None):
def jsapi_ticket(self, appid=None, secret=None, token=None, storage=None, token_fetched_func=None):
def refresh_ticket(self, appid=None, secret=None, token=None, type='jsapi', storage=None, token_fetched_func=None):
Metadata
Release files for pywe-ticket 1.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pywe-ticket-1.1.1.tar.gz | 3.5 kB | Without provenance | Details for pywe-ticket-1.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pywe_ticket-1.1.1-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details for pywe_ticket-1.1.1-py2.py3-none-any.whl |
Total release size: 7.6 kB
Release files / pywe-ticket-1.1.1.tar.gz
| Download URL | pywe-ticket-1.1.1.tar.gz |
|---|---|
| Size | 3.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
febebcb33121a3f918c2f2f35c29943caae0ebc92749397fe06eb129bf22e529
|
|
BLAKE2b-256 checksum How to use checksums |
f7c3d59e3f255818284f53b1dc3ddadc62ea9c097602f0d709b9038ae3182388
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / pywe_ticket-1.1.1-py2.py3-none-any.whl
| Download URL | pywe_ticket-1.1.1-py2.py3-none-any.whl |
|---|---|
| Size | 4.1 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
8466a5dfe16d7e14b6f45b5f428ca66a3fe323c74cc820b977080c2836d7e2ab
|
|
BLAKE2b-256 checksum How to use checksums |
a8004e8bd09de8cb5e4f40c809bbc1061458f05537fa81474796d968fcd6c5c2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for pywe-ticket 1.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.