Python Requests and network rail data feeds

351 views
Skip to first unread message

gerardh...@gmail.com

unread,
Feb 7, 2017, 9:52:33 AM2/7/17
to A gathering place for the Open Rail Data community
Hi all,

I'm wondering if it is possible to use python requests to access the network rail feeds.

import requests

r = requests.get("https://datafeeds.networkrail.co.uk:61618/topic/VSTP_All",auth=("$my_name$","$pass$"),timeout=1)
print r.status_code

requests.exceptions.ReadTimeout: HTTPSConnectionPool(host='datafeeds.networkrail.co.uk', port=61618): Read timed out. (read timeout=1)

However, I am getting a time out. Can anyone advise? Is there something fundamental which means only stomp will work?

Thanks!

Peter Hicks

unread,
Feb 7, 2017, 9:53:48 AM2/7/17
to gerardh...@gmail.com, A gathering place for the Open Rail Data community

Hello

You can only use Stomp or Openwire - HTTP isn't available.

Peter


--
You received this message because you are subscribed to the Google Groups "A gathering place for the Open Rail Data community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to openraildata-t...@googlegroups.com.
To post to this group, send an email to openrail...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

gerardh...@gmail.com

unread,
Feb 7, 2017, 12:38:47 PM2/7/17
to A gathering place for the Open Rail Data community, gerardh...@gmail.com
Thanks Peter,

Can you point me to a simple Stomp implementation? I've struggled with the examples.

I'd like to return a JSON response for the VSTP_All, for example

Many thanks

G

Chris Northwood

unread,
Feb 7, 2017, 2:23:41 PM2/7/17
to gerardh...@gmail.com, openraildata-talk
Hi Gerard,

I think you misunderstand the nature of the API. It's not a REST or web based API, but an event based message queue. You have to connect and stay connected until a message is sent and then handle it. If you're not connected at all times, you will miss messages (with some caveats). It's probably very different to other types of API you've used before.

Chris

--
You received this message because you are subscribed to the Google Groups "A gathering place for the Open Rail Data community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to openraildata-talk+unsubscribe@googlegroups.com.
To post to this group, send an email to openraildata-talk@googlegroups.com.

gerardh...@gmail.com

unread,
Feb 8, 2017, 3:21:11 AM2/8/17
to A gathering place for the Open Rail Data community, gerardh...@gmail.com
On Tuesday, 7 February 2017 14:52:33 UTC, gerardh...@gmail.com wrote:
Chris,

Ah, the penny has dropped! I now understand this difference. I had the wrong mental model.

Many thanks!

G
Reply all
Reply to author
Forward
0 new messages