/ÖÐÎÄ/
/ÖÐÎÄ/
/ÖÐÎÄ/
/ÖÐÎÄ/
/ÖÐÎÄ/
/ÖÐÎÄ/
/ÖÐÎÄ/
/ÖÐÎÄ/
/ÖÐÎÄ/
/ÖÐÎÄ/
¶à˵SDK for Python/ Django AppÆÀÂÛ²å¼þ£¬ÊÊÓÃÓÚʹÓÃPythonÓïÑÔ¿ª·¢µÄÍøÕ¾£¬¿ª·¢Õß¿ÉÒÔʹÓÃSDK°üÀ´ÒýÈë¶à˵ÆÀÂÛ²å¼þ£¬Í¬Ê±Ò²°üº¬DjangoµÄTemplate tagºÍ¼òµ¥µÄmanager£¬ËùÒÔÒ²¿ÉÒÔ×÷ΪDjango AppÀ´Ê¹Óá£
¶à˵²å¼þ¹¦ÄÜ
µ÷ÓÃAPI½Ó¿Ú£º·â×°Á˶Զà˵API½Ó¿ÚµÄÇëÇ󣬷µ»ØJSONÊý¾Ý¡£
SSOºÍ±¾µØÉí·Ý£º´¦ÀíSSOÖн»»»tokenµÄÂß¼£¬ÒÔ¼°ÆÀÂÛ¿òÏÔʾ±¾µØÉí·ÝÐèÒªµÄRemote AuthµÄ´¦Àí¡£
DjangoµÄÖ§³Ö£ºÔÚDjangoÖÐÖ±½Óµ÷ÓÃÏà¹ØµÄTemplate tag£¬´«Èë¶à˵Short name¾Í¿ÉÒÔµ÷ÓÃÆÀÂÛ¿ò¡£
ÔËÐл·¾³
Python 2.6+
°²×°
python setup.py install
ÔÚPythonÖÐʹÓÃ
from duoshuo import DuoshuoAPI
code = reqeust.GET.get(code)
api = DuoshuoAPI(short_name=YOUR_DUOSHUO_SHORT_NAME, secret=YOUR_DUOSHUO_SECRET)
#ÀýÈçÒª»ñÈ¡Óû§ÐÅÏ¢
api.users.details(user_id=1)
¸ü¶àAPI¿ÉÒԲ鿴¶à˵¿ª·¢Îĵµ ¡£
Django Usage
×÷ΪDjango appÀ´Ê¹ÓÃ
0. °²×°duoshuo²å¼þ
python setup.py install
INSTALLED_APPS = (
...
'duoshuo',
)
# settings.py
DUOSHUO_SECRET = 'ÄãµÄ¶à˵secret'
DUOSHUO_SHORT_NAME = 'ÄãµÄ¶à˵short name'
1. ÏÔʾ¶à˵ÆÀÂÛ¿ò
{% load duoshuo_tags %}
{% duoshuo_comments %}
#¸ø¶à˵ÆÀÂÛ¿ò´«µÝÆäËûshort name
{% duoshuo_comments 'ÆäËûshort name' %}
2. Óû§µÇ¼ºó,ÔÚÆÀÂÛ¿òÏÔʾ±¾µØÉí·Ý
# Çë·ÅÔÚ¶à˵ÆÀÂÛ¿òtag: {{ duoshuo_comments }} Ö®ºó
{{ request.user|remote_auth|safe }}
¹ØÓÚÌÚÅ£ | ÁªÏµ·½Ê½ | ·¢Õ¹Àú³Ì | °æȨÉùÃ÷ | ÏÂÔØ°ïÖú(£¿) | ¹ã¸æÁªÏµ | ÍøÕ¾µØͼ | ÓÑÇéÁ´½Ó
Copyright 2005-2022 QQTN.com ¡¾ÌÚÅ£Íø¡¿ °æȨËùÓÐ ¶õICP±¸2022005668ºÅ-1 | ¶õ¹«Íø°²±¸ 42011102000260ºÅ
ÉùÃ÷£º±¾Õ¾·ÇÌÚѶQQ¹Ù·½ÍøÕ¾ ËùÓÐÈí¼þºÍÎÄÕÂÀ´×Ô»¥ÁªÍø ÈçÓÐÒìÒé ÇëÓë±¾Õ¾ÁªÏµ ±¾Õ¾Îª·ÇÓ®ÀûÐÔÍøÕ¾ ²»½ÓÊÜÈκÎÔÞÖúºÍ¹ã¸æ