生成微博授權url

2022-08-12 11:45:16 字數 1045 閱讀 9369

'''

'''2.2 新增子路由: oauth/urls.py

'''from django.urls import path from . import views urlpatterns =[

]'''

2.3 在syl/settings.py中新增應用

', ]

'''2.4 在syl/urls.py主路由中新增

''' urlpatterns = [    path('

oauth/

', include('

oauth.urls

')), ]

生成微博授權url介面

1,新增子路由: oauth/urls.py

urlpatterns = [    path('

weibo/

', views.weibourl.as_view()),  #

/oauth/weibo/ 返回微博登入位址 ]

2, syl/settings.py配置微博位址

3, 檢視函式: oauth/views.py

1

from rest_framework.permissions import

allowany

2from

rest_framework.respons

3import response from rest_framework.views import apiview from urllib.parse import

urlencode

4class

weibourl(apiview):    

5       #

微博oauth認證位址       client_id=4152203033&                         # 註冊開發者id      

3.測試生成微博售前url介面

生成微博授權URL

目錄2.生成微博授權url介面 3.測試生成微博授權url介面 2.2 新增子路由 oauth urls.py from django.urls import path from import views urlpatterns 2.3 在syl settings.py中新增應用 2.4 在syl ...

生成微博授權URL介面

2.2 新增子路由 oauth urls.py from django.urls import path from import views urlpatterns 2.3 在syl settings.py中新增應用 2.4 在syl urls.py主路由中新增 urlpatterns path o...

生成微博授權URL介面

from django.urls import path from import views urlpatterns urlpatterns path oauth include oauth.urls urlpatterns path weibo views.weibourl.as view oau...