Monday, June 11, 2012

Sending XML Queries in python using urllib2


Query is the xml string that you want to send.  Modify the content type according to your needs.

    def send_xml_query(self, query, host, port):



        query = query.replace ('\n', '')

        headers = {"Content-type": "application/xml"}

        host = 'http://%s:%s' % (host, port)

        request = urllib2.Request(host, query, headers)

        response = urllib2.urlopen(request)

        return request, response

19 comments:

Sadiya Moshin said...

Really very useful and awesome collection..Thank you...:)

Muneer Azhar said...

Excellent work. Thank you.

Amar G said...

hank you so much for putting these questions up they have been most helpful.

Muneer Azhar said...
This comment has been removed by the author.
Gokul Ravi said...

Really very useful Thank you

Pranam Bennur said...

thanks you

Suresh R said...

Really very useful and awesome collection..Thank you...:)

Mounika Karoshi said...

very helpful

Suresh R said...

wonderful job

deepk said...

very useful and awesome collection..

mojah said...

very useful

sujay said...

helpful blog

lokesh said...

intresting blog and very useful

viswanath said...

very nice blog python training in bangalore
blockchain training in bangalore

Suresh R said...

excellent blog python interview questions

I Digital Academy said...

Nice post.
Best SAP Training in Bangalore
Best Oracle Training in Bangalore

Chaithra L said...

It'S A Really Helpful Blog Thank You For Sharing.....
Advanced Digital Marketing Course in Bangalore

Muneer Azhar said...

I got nice blog
jquery interview questions
sql interview questions
sap partner companies in bangalore
sap implementation companies in bangalore
sap partners in india
aws staffing

Muneer Azhar said...

Nice
angular4 interview questions
python interview questions
artificial intelligence interview questions


python online training
artificial intelligence online training