I want to get data from a web service. For this use the following URL on Postman:
http://x.x.x.x:8090/api/jserv.ashx?action=ReportMethod // has a paramater
And I have to add a raw in Postman (Body->raw) like the following to verify user:
{
"user": {
"userid": "35acf0eb-084c-4328-a022-fbdddb419873",
"username": "User",
"status": false,
"mesaj": null,
"masterno": 0,
"versiyon": null
},
"start": "1900-01-01T00:00:00",
"end": "2020-02-25T00:00:00"
}
When I use Postman I can get data. When I use Python request with Django:
headers = {'content-type': 'application/json'}
url = 'http://x.x.x.x:8090/api/jserv.ashx'
params = {'action': 'ReportMethod'}
data = {"user": { "userid": "xxxx","username": "User","status": "false","mesaj": "null","masterno": 0,"versiyon": "null"},"start": "1900-01-01T00:00:00","end": "2020-02-25T00:00:00"}
r = requests.post(url, params=params, data=json.dumps(data), headers=headers)
I got error:
HTTPConnectionPool(host='x.x.x.x', port=8090): Max retries exceeded with url: /api/jserv.ashx?action=ReportMethod (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f4649c98eb8>: Failed to establish a new connection: [Errno 110] Connection timed out',))
How can solve this problem?