I am using the requests module in Python and seem to be experiencing an issue with it adding a trailing slash after the URL. I have tried removing this using different methods (replace, regex) but it doesn't seem to make any difference. Some details have been replace for privacy reason obviously :)
url = 'http://example.com:8000'
payload = {}
payload['summary'] = "test"
payload['service'] = 10
payload['template'] = 'XXX11112222'
payload['user_name'] = 'john_smith'
payload['justification'] = 'required'
payload['start_date'] = '1417737600'
payload['end_date'] = '1417759200'
r = requests.post(url, params=payload)
print(r.url)
The URL printed comes out as this.
http://X.X.X.X:8000/?end_date=1417759200&business_justification=required&service=10&summary=test&template=XXX11112222&user_name=john_smith&start_date=1417737600
And gives me this response.
200
400 No requested_service or service Parameter Provided
When I grab that URL and put it in an browser and remove the '/' before the '?' it works fine. Eg: http://example.com:8000?.... works, however http://example.com:8000/?... does not. But I can't work out how to remove the trailing slash off the URL in the Python script.