Пытаюсь подключиться к Vertiv API для получения информации о данных PDU через python с использованием приведенного ниже кода, но я продолжаю получать эту ошибку. IP-адрес и информация для входа в систему верны, потому что мне удалось подключиться через GUI. поэтому мне нужно что-то установить внутри приложения для запросов на подключение?
import requests
import json
##### Section: Authenticate to the API
# Set the base URL for the API call
base = 'http://15.10.10.100:8080/api/v1' #This is the URL to an ACS devices API
# Define the final portion of the URL for authenticating and getting an auth token
sessionlogin = '/sessions/login'
# Build the final URL to send
final_url = base + sessionlogin
# Set the POST parameters
headers = {'Content-Type': 'application/json'} #Have to set it to JSON
credentials = {'username': 'access_username', 'password': 'user_password'} #Default username and password for an ACS device.
# Send the POST and the parameters
response = requests.post(final_url, data=json.dumps(credentials), headers=headers) #Sending the POST authentication
Это сообщение об ошибке, которое я получаю.
raceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/urllib3/connection.py", line 160, in _new_conn
(self._dns_host, self.port), self.timeout, **extra_kw
File "/usr/local/lib/python3.6/site-packages/urllib3/util/connection.py", line 84, in create_connection
raise err
File "/usr/local/lib/python3.6/site-packages/urllib3/util/connection.py", line 74, in create_connection
sock.connect(sa)
ConnectionRefusedError: [Errno 111] Connection refused
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 677, in urlopen
chunked=chunked,
File "/usr/local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 392, in _make_request
conn.request(method, url, **httplib_request_kw)
File "/usr/lib64/python3.6/http/client.py", line 1254, in request
self._send_request(method, url, body, headers, encode_chunked)
File "/usr/lib64/python3.6/http/client.py", line 1300, in _send_request
self.endheaders(body, encode_chunked=encode_chunked)
File "/usr/lib64/python3.6/http/client.py", line 1249, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
File "/usr/lib64/python3.6/http/client.py", line 1036, in _send_output
self.send(msg)
File "/usr/lib64/python3.6/http/client.py", line 974, in send
self.connect()
File "/usr/local/lib/python3.6/site-packages/urllib3/connection.py", line 187, in connect
conn = self._new_conn()
File "/usr/local/lib/python3.6/site-packages/urllib3/connection.py", line 172, in _new_conn
self, "Failed to establish a new connection: %s" % e
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0x7f535f6b1a90>:
Failed to establish a new connection: [Errno 111] Connection refused