Persistent HTTP Connections with Python?

Discussion in 'Python' started by Scott Sharkey, Jan 10, 2008.

  1. Hello All,

    I am trying to write a python script to talk to an xml-based stock feed
    service. They are telling me that I must connect and login, and then
    "issue refresh requests" to fetch the data. This sounds a lot (to me)
    like HTTP 1.1 persistent connections. Can I do that with the urllib
    functions, or do I need to use the httplib functions for this kind of
    work. Pointers and/or sample code would be much appreciated.

    Thanks!

    -scott
    Scott Sharkey, Jan 10, 2008
    #1
    1. Advertising

  2. Scott Sharkey

    Ivan Novick Guest

    On Jan 10, 10:46 am, Scott Sharkey <>
    wrote:
    > Hello All,
    >
    > I am trying to write a python script to talk to an xml-based stock feed
    > service. They are telling me that I must connect and login, and then
    > "issue refresh requests" to fetch the data. This sounds a lot (to me)
    > like HTTP 1.1 persistent connections. Can I do that with the urllib
    > functions, or do I need to use the httplib functions for this kind of
    > work. Pointers and/or sample code would be much appreciated.


    Your questions leaves out all important details like the exact nature
    of the API being provided. I highly doubt HTTP persistent connections
    has anything to do with what you will need to connect to there
    service.

    Services like this normally come with example code, i recommend you
    get access to that.

    Regards,
    Ivan Novick
    http://www.0x4849.net
    Ivan Novick, Jan 11, 2008
    #2
    1. Advertising

  3. Scott Sharkey

    Rob Kapteyn Guest

    On Jan 10, 12:46 pm, Scott Sharkey <>
    wrote:
    > Hello All,
    >
    > I am trying to write a python script to talk to an xml-based stock feed
    > service.  They are telling me that I must connect and login, and then
    > "issue refresh requests" to fetch the data.  This sounds a lot (to me)
    > like HTTP 1.1persistentconnections.  Can I do that with the urllib
    > functions, or do I need to use the httplib functions for this kind of
    > work.  Pointers and/or sample code would be much appreciated.
    >
    > Thanks!
    >
    > -scott


    I used to work in the financial industry and I have seen this.
    It is sort of like the XML RSS feed that web sites provide -- but like
    many financial protocols they created their own standard.
    Python httplib can be used to create a SERVER for persistent HTTP
    connections -- but want you want is a client.
    I think this is actually very simple.
    What happens when you open the data URL with a web browser ?
    Does the connection stay open and automatically update each time there
    is new data ?
    If so, just use urllib, leave the connection open and do a read()
    every so often to see if there is new data.
    Good luck!
    -Rob
    Rob Kapteyn, Jan 12, 2008
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Alex Hunsley

    HTTP/1.1 persistent connections

    Alex Hunsley, Feb 13, 2004, in forum: Java
    Replies:
    4
    Views:
    2,439
    Alex Hunsley
    Feb 13, 2004
  2. webdev50
    Replies:
    0
    Views:
    686
    webdev50
    Sep 26, 2005
  3. Replies:
    0
    Views:
    987
  4. jobs
    Replies:
    2
    Views:
    878
  5. gk
    Replies:
    7
    Views:
    953
    Tom Anderson
    Oct 12, 2010
Loading...

Share This Page