Programmatically log in and request XML

T

Tim Johnson

FYI: Using python 2.7 on ubuntu 10.04.

I have acquainted myself with the parsing of XML data using an input file as
test data. Now I need to make a request the feed itself, and capture
that field as data.

I need to do the following:
1)Programmatically log into a site with user and password.
2)Make a GET request to a site under the same domain.

Since I have used urllib2 in the past,
I am offering a modification of the example under the heading:
"""
Use of Basic HTTP Authentication
"""
import urllib2
# Create an OpenerDirector with support for Basic HTTP Authentication...
auth_handler = urllib2.HTTPBasicAuthHandler()
auth_handler.add_password(realm=None,
uri='http://retsgw.flexmls.com:80/rets2_0/Login',
user='******',
passwd='******')
opener = urllib2.build_opener(auth_handler)
# ...and install it globally so it can be used with urlopen.
urllib2.install_opener(opener)
urllib2.urlopen('http://retsgw.flexmls.com/rets2_0/GetMetadata?Type=METADATA-TABLE&ID=Property:A&Format=STANDARD-XML')

Am I at the correct starting point?
If so, I can take it from there
If not,
Can someone recommend a better approach?

thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,022
Latest member
MaybelleMa

Latest Threads

Top