Web servers

Dave Angel davea at ieee.org
Mon Nov 16 21:29:24 CET 2009

Virgil Stokes wrote:
> <div class="moz-text-flowed" style="font-family: -moz-fixed">Any 
> suggestions on using Python to connect to Web servers (e.g. to access 
> financial time series data)?
> --V. Stokes
You can open a web page for reading with  urllib2 module.  You can parse 
html with beautiful soup, or if it's clean xhtml, with the xml module.

But parsing raw html is error prone, and subject to change as the web 
designer reorganizes things.  So many web servers also have a protocol 
intended for data (as opposed to intended for a browser).  This is 
specific to each service, however.  If you want to get started in your 
reading, you could google for "web services", which is one approach 
using SOAP & WSDL.

Note also that most servers have restrictions on the data you access 
this way.  They may or may not be enforceable, but if you access a lot 
of data from a server, you may be too big a drain on its resources, if 
it's configured for browser access only.


More information about the Python-list mailing list