metabase/python api ConnectionRefusedError:[WinError 10061]无法建立连接,因为目标计算机主动拒绝它

2024-05-28 19:25:27 发布

您现在位置:Python中文网/ 问答频道 /正文

我在Metabase中的数据库中有数据,而不是通过API提取的数据

https://www.metabase.com/learn/administration/metabase-api

根据建议,我正在使用下面的代码访问它:

import requests
import pandas as pd

response = requests.post('http://localhost:3000/api/session',
                         json={'username': '*********',
                               'password': '*******'})
session_id = response.json()['id']
headers = {'X-Metabase-Session': session_id}

但是,我无法通过localhost获取错误

ConnectionRefusedError: [WinError 10061] No connection could be made because the target machine actively refused it

HTTPConnectionPool(host='localhost', port=3000): Max retries exceeded with url: /api/session (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x000002310642FE80>: Failed to establish a new connection: [WinError 10061] No connection could be made because the target machine actively refused it'))

我如何解决这个问题


Tags: 数据noimportapiidjsonlocalhostresponse

热门问题