大家好,我试图使用Servicenow API进行更改,但是出现以下错误。
我的代码:-
import requests
url="https://******.service-now.com/api/now/table/change_request"
user="***"
password="*****"
headers={"Content-Type":"application/json","Accept":"application/json"}
response = requests.put(url, auth=(user, password), headers=headers ,data="<request><entry><assignment_group>testgroup</assignment_group><category>prod</category><requested_by>user1</requested_by><type>comprehensive</type></entry></request>")
print(response.status_code)
#print(response.json())
我得到的错误:-
Traceback (most recent call last):
File "****\Python\Python36-32\lib\site-packages\urllib3\connection.py", line 141, in _new_conn
(self.host, self.port), self.timeout, **extra_kw)
File "******\Python\Python36-32\lib\site-packages\urllib3\util\connection.py", line 60, in create_connection
for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM):
File "*******\Python\Python36-32\lib\socket.py", line 745, in getaddrinfo
for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno 11001] getaddrinfo failed
当我使用 get 执行请求时,它可以很好地打印状态代码200,但是当我使用 .put 和数据它引发错误。
response=requests.get(url,auth=(user,password),headers=headers)
你能帮我...