Django WeChat OAuth2/Share/Token API
Project description
Django WeChat OAuth2/Share/Token API
Installation
pip install django-we
Urls.py
urlpatterns = [ url(r'^we/', include('django_we.urls', namespace='django_we')), ]
or:
from django.conf.urls import include, url from django_we import views as we_views # WeChat OAuth2 urlpatterns = [ url(r'^o$', we_views.we_oauth2, name='shorten_o'), url(r'^oauth$', we_views.we_oauth2, name='shorten_oauth'), url(r'^oauth2$', we_views.we_oauth2, name='shorten_oauth2'), url(r'^we_oauth2$', we_views.we_oauth2, name='we_oauth2'), url(r'^base_redirect$', we_views.base_redirect, name='base_redirect'), url(r'^userinfo_redirect$', we_views.userinfo_redirect, name='userinfo_redirect'), url(r'^direct_base_redirect$', we_views.direct_base_redirect, name='direct_base_redirect'), url(r'^direct_userinfo_redirect$', we_views.direct_userinfo_redirect, name='direct_userinfo_redirect'), ] # WeChat Share urlpatterns += [ url(r'^ws$', we_views.we_share, name='shorten_we_share'), url(r'^weshare$', we_views.we_share, name='we_share'), ] # WeChat JSAPI Signature urlpatterns += [ url(r'^js$', we_views.we_jsapi_signature_api, name='shorten_we_jsapi_signature_api'), url(r'^jsapi_signature$', we_views.we_jsapi_signature_api, name='we_jsapi_signature_api'), ] # WeChat Token urlpatterns += [ url(r'^token$', we_views.we_access_token, name='we_token'), url(r'^access_token$', we_views.we_access_token, name='we_access_token'), ]
Settings.py
INSTALLED_APPS = ( ... 'django_we', ... ) # Wechat Settings WECHAT = { 'JSAPI': { 'token': '5201314', 'appID': '', 'appsecret': '', 'mchID': '', 'apiKey': '', 'mch_cert': '', 'mch_key': '', 'redpack': { 'SEND_NAME': '', 'NICK_NAME': '', 'ACT_NAME': '', 'WISHING': '', 'REMARK': '', } }, } # Wechat OAuth Cfg DJANGO_WE_OAUTH_CFG = 'JSAPI' # Default ``JSAPI`` # Based on Urls.py # WECHAT_OAUTH2_REDIRECT_URI = 'https://we.com/we/we_oauth2?scope={}&redirect_url={}' # WECHAT_OAUTH2_REDIRECT_URI = 'https://we.com/we/o?scope={}&r={}' # Shorten URL WECHAT_OAUTH2_REDIRECT_URI = 'https://we.com/we/o?r={}' # Shorten URL Farther, Scope default ``snsapi_userinfo`` WECHAT_BASE_REDIRECT_URI = 'https://we.com/we/base_redirect' WECHAT_USERINFO_REDIRECT_URI = 'https://we.com/we/userinfo_redirect' WECHAT_DIRECT_BASE_REDIRECT_URI = 'https://we.com/we/direct_base_redirect' WECHAT_DIRECT_USERINFO_REDIRECT_URI = 'https://we.com/we/direct_userinfo_redirect' # Temp Share Page to Redirect WECHAT_OAUTH2_REDIRECT_URL = ''
Wechat_Only
# Settings.py MIDDLEWARE = [ ... 'detect.middleware.UserAgentDetectionMiddleware', ... ] WECHAT_ONLY = True # Default False # Usage from django_we.decorators import wechat_only @wechat_only def xxx(request): """ Docstring """
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
django-we-1.5.3.tar.gz
(10.7 kB
view details)
Built Distribution
File details
Details for the file django-we-1.5.3.tar.gz
.
File metadata
- Download URL: django-we-1.5.3.tar.gz
- Upload date:
- Size: 10.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/18.5 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/2.7.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b9988faa7d444e153a0083b9ab5bd8f29dac3ae1bef7a7cb5a9c67c98331d7b1 |
|
MD5 | 5d096ddf84a90b419cc2c53376a3520e |
|
BLAKE2b-256 | dc7b0d86cc116444b91523f60892481cc20989dcd12ae2f8880955283c704b5b |
File details
Details for the file django_we-1.5.3-py2.py3-none-any.whl
.
File metadata
- Download URL: django_we-1.5.3-py2.py3-none-any.whl
- Upload date:
- Size: 14.4 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/18.5 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/2.7.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 39788dbc327030ec7c0128c460fc83312a6baf1c3a96ee836e9b815390030e73 |
|
MD5 | 6bfa8fd9a65f7b06bef81412864bf1a9 |
|
BLAKE2b-256 | 9a2cc3e0927b97b58c383722e43301d54be229c13fa73493177f70a80d4640df |