【爬虫】 爬虫请求json数据,返回乱码问题的解决

from django.http import JsonResponse
from rest_framework.utils import json

from utils import requests_pro
# from rest_framework.views import  APIView
from lxml import etree
from utils import orm
orm.orm_standby()
from dal import models

# class WeekRequests(APIView):
#     def get(self,request):
#         message = {}
#         try:

sessions =requests_pro.session_requests_b()

url="https://movie.douban.com/j/search_subjects?type=movie&tag=%E7%83%AD%E9%97%A8&sort=recommend&page_limit=20&page_start=0"

ret = sessions.get(url=url)

ret.encoding="utf-8"
ret_text =ret.text
print(ret_text)

猜你喜欢

转载自www.cnblogs.com/wanghong1994/p/12370940.html
今日推荐