Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

requests.exceptions.ConnectionError: HTTPConnectionPool(host='8.218.239.54', port=8080 #8

Open
lileishitou opened this issue Apr 23, 2024 · 1 comment

Comments

@lileishitou
Copy link

import requests
import json

url = 'http://0.0.0.0:8005/virtual'

data = {

"category": "Media",

"tool_name": "newapi_for_media",

"api_name": "url",

"tool_input": {'url': 'https://api.socialmedia.com/friend/photos'},

"strip": "",

"toolbench_key": "XXXXXXX"

}

data = {
"category": "Search",
"tool_name": "wiki_search",
"api_name": "wiki_search",
"tool_input": {'q': '老大是谁?'},
"strip": "",
"toolbench_key": "XXXXX"
}

headers = {
'accept': 'application/json',
'Content-Type': 'application/json',
}

Make the POST request

response = requests.post(url, headers=headers, data=json.dumps(data))
print(response.text)

已经有了toolbenchkey , 但是报下属错误:

requests.exceptions.ConnectionError: HTTPConnectionPool(host='8.218.239.54', port=8080): Max retries exceeded with url: /rapidapi (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7fd8b84c8520>: Failed to establish a new connection: [Errno 110] Connection timed out'))

@zhichengg
Copy link
Collaborator

看上去是连接到toolbench服务器有些问题,你可以通过下面的代码测试toolbench的连接:

import requests

url  = "http://8.218.239.54:8080/rapidapi"
payload = {

    "category": "Food",
    "tool_name": "yummly",
    "api_name": "categories_list",
    "tool_input": "{}",
    "strip": "truncate",
    'toolbench_key': ''
}

headers = {'toolbench_key': ''}
response = requests.post(url, json=payload, headers=headers)
print(response.text)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants