# coding:utf-8
"""
Compatible for python2.x and python3.x
requirement: pip install requests
"""
from __future__ import print_function
import requests
import json
# 请求示例 url 默认请求参数已经做URL编码
#url = "https://uat.yeeoffice.cn/YeeOfficeSettings/_API/Ver(3.0)/api/crafts/datas/id"
url = "https://api.douban.com//v2/movie/top250"
headers = {
"Accept-Encoding": "gzip",
"Connection": "close"
#"AkmiiSecret": ""
}
#postdata = {
# "ListDataID":"",
# "ListID":"",
# "Columns":[""],
# "AppID":41
# }
if __name__ == "__main__":
#r = requests.post(url, data=postdata,headers=headers)
r = requests.get(url, headers=headers)
jsonobj = r.json()
t1 = json.loads(r.text.decode('utf-8').encode('gb2312'))
newjsonobj = json.dumps(t1,indent=4)
print(newjsonobj)
#print(type(jsonobj))
"""
Compatible for python2.x and python3.x
requirement: pip install requests
"""
from __future__ import print_function
import requests
import json
# 请求示例 url 默认请求参数已经做URL编码
#url = "https://uat.yeeoffice.cn/YeeOfficeSettings/_API/Ver(3.0)/api/crafts/datas/id"
url = "https://api.douban.com//v2/movie/top250"
headers = {
"Accept-Encoding": "gzip",
"Connection": "close"
#"AkmiiSecret": ""
}
#postdata = {
# "ListDataID":"",
# "ListID":"",
# "Columns":[""],
# "AppID":41
# }
if __name__ == "__main__":
#r = requests.post(url, data=postdata,headers=headers)
r = requests.get(url, headers=headers)
jsonobj = r.json()
t1 = json.loads(r.text.decode('utf-8').encode('gb2312'))
newjsonobj = json.dumps(t1,indent=4)
print(newjsonobj)
#print(type(jsonobj))