Skip to content

Instantly share code, notes, and snippets.

@coderhs
Created July 23, 2012 07:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save coderhs/3162455 to your computer and use it in GitHub Desktop.
Save coderhs/3162455 to your computer and use it in GitHub Desktop.
import httplib
c=httplib.HTTPConnection('localhost:9002')
headers = {"Content-type": "text/xml;charset=UTF-8", "Accept": "text/xml"}
params = """<ENVELOPE>
<HEADER>
<TALLYREQUEST>Export Data</TALLYREQUEST>
</HEADER>
<BODY>
<EXPORTDATA>
<REQUESTDESC>
<REPORTNAME>List of Accounts</REPORTNAME>
<STATICVARIABLES>
<SVEXPORTFORMAT>$$SysName:XML</SVEXPORTFORMAT>
<ACCOUNTTYPE>Ledgers</ACCOUNTTYPE>
<ENCODINGTYPE>UNICODE</ENCODINGTYPE>
</STATICVARIABLES>
</REQUESTDESC>
</EXPORTDATA>
</BODY>
</ENVELOPE>
"""
c.request("POST", "/", params, headers)
r=c.getresponse().read()
fl=file("xtemp.xml","w")
fl.write(r)
fl.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment