【发布时间】:2021-04-11 03:27:37
【问题描述】:
我正在尝试导入 Json API 的 URL,但收到错误消息:
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
<ipython-input-18-5f40dac6d9a4> in <module>
1 # get data from the API
2 url = 'https://admin.appnext.com/offerApi.aspx?pimg=1&city=1&ua=1&id=5da11d20-0a32-4852-8233-39b711a360a9'
----> 3 r = http.request('GET', url)
4 r.status
NameError: name 'http' is not defined
我使用的代码如下:
# data retrieval
import urllib3
from urllib3 import request
# json data
import json
# pandas dataframes
import pandas as pd
没有问题要导入
# get data from the API
url = 'https://admin.appnext.com/offerApi.aspx?pimg=1&city=1&ua=1&id=5da11d20-0a32-4852-8233-39b711a360a9'
r = http.request('GET', url)
r.status
有人知道可能是什么问题吗?
提前致谢
【问题讨论】: