Estoy tratando de obtener la información de la API para poder decidir con qué columnas empezar a trabajar. Escribí esto por ahora pero me tira error:
#Data
url = "https://ftx.us/api"
data = requests.get(url)
df = pd.read_json(url)
ERROR:
Traceback (most recent call last):
File "c:\Users\angel\OneDrive\Escritorio\PROYECTO 3\streamlit_app.py", line 21, in <module>
df = pd.read_json(url)
File "C:\Users\angel\AppData\Local\Programs\Python\Python310\lib\site-packages\pandas\util\_decorators.py", line 207, in wrapper
return func(*args, **kwargs)
File "C:\Users\angel\AppData\Local\Programs\Python\Python310\lib\site-packages\pandas\util\_decorators.py", line 311, in wrapper
return func(*args, **kwargs)
File "C:\Users\angel\AppData\Local\Programs\Python\Python310\lib\site-packages\pandas\io\json\_json.py", line 588, in read_json
json_reader = JsonReader(
File "C:\Users\angel\AppData\Local\Programs\Python\Python310\lib\site-packages\pandas\io\json\_json.py", line 673, in __init__
data = self._get_data_from_filepath(filepath_or_buffer)
File "C:\Users\angel\AppData\Local\Programs\Python\Python310\lib\site-packages\pandas\io\json\_json.py", line 710, in _get_data_from_filepath
self.handles = get_handle(
File "C:\Users\angel\AppData\Local\Programs\Python\Python310\lib\site-packages\pandas\io\common.py", line 667, in get_handle
ioargs = _get_filepath_or_buffer(
File "C:\Users\angel\AppData\Local\Programs\Python\Python310\lib\site-packages\pandas\io\common.py", line 336, in _get_filepath_or_buffer
with urlopen(req_info) as req:
File "C:\Users\angel\AppData\Local\Programs\Python\Python310\lib\site-packages\pandas\io\common.py", line 236, in urlopen
return urllib.request.urlopen(*args, **kwargs)
File "C:\Users\angel\AppData\Local\Programs\Python\Python310\lib\urllib\request.py", line 216, in urlopen
return opener.open(url, data, timeout)
File "C:\Users\angel\AppData\Local\Programs\Python\Python310\lib\urllib\request.py", line 525, in open
response = meth(req, response)
File "C:\Users\angel\AppData\Local\Programs\Python\Python310\lib\urllib\request.py", line 634, in http_response
response = self.parent.error(
File "C:\Users\angel\AppData\Local\Programs\Python\Python310\lib\urllib\request.py", line 563, in error
return self._call_chain(*args)
File "C:\Users\angel\AppData\Local\Programs\Python\Python310\lib\urllib\request.py", line 496, in _call_chain
result = func(*args)
File "C:\Users\angel\AppData\Local\Programs\Python\Python310\lib\urllib\request.py", line 643, in http_error_default
raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 403: Forbidden
requests.get
, el resultado lo estás guardando endata
, deberías revisar el contenido dedata
, haciendo unprint(data.text)