XML : Unable to send the POST request of XML in Python

I have the attached the request captured by tamper data (This is an API request). When I click 'send' I am trying to make the same request through Python, but some how only the url part is getting executed. enter image description here

Here is my code:

  import requests  import urllib2  import json  import httplib, urllib    try:      params=urllib.urlencode({'data':'<?xml+version="1.0"+encoding="ISO-8859-1"?><!DOCTYPE+MESSAGE+SYSTEM+"http://127.0.0.1:80/psms/dd/msg12.dtd"><MESSAGE+VER="1.2"><USER+USERNAME="dd"+PASSWORD="dd"/><SMS++UDH="0"+CODING="1"+TEXT="this+is+test"+PROPERTY="0"+ID="1"><ADDRESS+FROM="dd"+TO="123456789"+SEQ="1"+TAG="some+clientside+random+data"/></SMS></MESSAGE>', 'action':'send'})      headers={"Content-Type": "application/xml"}      conn=httplib.HTTPConnection("api.blahblah.com")      url="/psms/servlet/psms.Eservice2"      response=conn.request("POST",url,params,headers)        print response      conn.close()  except Exception as i :      print i    

No comments:

Post a Comment