Thanks Yvonne
I have no trouble accessing the data, i get a response back every time.
However it is decoding the response that is a problem.
I have uploaded my script and examples of failure and working content to https://drive.google.com/a/darkedges.com/folderview?id=0B9D-FwzEA1yYNVYtSThJdEZXNnc&usp=sharing
You can view a success using
node readFile.js myBinaryFile.works
You can view a failure using
node readFile.js myBinaryFile.fails
To run my script edit ferries.js
and replace with you details in client_id
and client_secret
and run with
node ferries.js
I have tried both at home and work to eliminate any network issues i.e proxy rewriting data etc and get the same issues.
If you look at the differences between myBinaryFile.works
and myBinaryFile.fails
you can see there is extra data being added to the myBinaryFile.fails
and I am not sure why. Unless of course the library I am using and the GTFS stream are incompatible. I am using the recommended library from Google for Node/Javascript.
Edit:
This is the exception I get from the Google Java Client
com.google.protobuf.InvalidProtocolBufferException: While parsing a protocol message, the input ended unexpectedly in the middle of a field. This could mean either than the input has been truncated or that an embedded message misreported its own length.
at com.google.protobuf.InvalidProtocolBufferException.truncatedMessage(InvalidProtocolBufferException.java:70)
at com.google.protobuf.CodedInputStream.refillBuffer(CodedInputStream.java:1082)
at com.google.protobuf.CodedInputStream.readRawByte(CodedInputStream.java:1149)
at com.google.protobuf.CodedInputStream.readRawVarint64SlowPath(CodedInputStream.java:778)
at com.google.protobuf.CodedInputStream.readRawVarint64(CodedInputStream.java:770)
at com.google.protobuf.CodedInputStream.readUInt64(CodedInputStream.java:338)
at com.google.transit.realtime.GtfsRealtime$FeedHeader.<init>(GtfsRealtime.java:1278)
at com.google.transit.realtime.GtfsRealtime$FeedHeader.<init>(GtfsRealtime.java:1212)
at com.google.transit.realtime.GtfsRealtime$FeedHeader$1.parsePartialFrom(GtfsRealtime.java:1311)
at com.google.transit.realtime.GtfsRealtime$FeedHeader$1.parsePartialFrom(GtfsRealtime.java:1306)
at com.google.protobuf.CodedInputStream.readMessage(CodedInputStream.java:495)
at com.google.transit.realtime.GtfsRealtime$FeedMessage.<init>(GtfsRealtime.java:172)
at com.google.transit.realtime.GtfsRealtime$FeedMessage.<init>(GtfsRealtime.java:119)
at com.google.transit.realtime.GtfsRealtime$FeedMessage$1.parsePartialFrom(GtfsRealtime.java:221)
at com.google.transit.realtime.GtfsRealtime$FeedMessage$1.parsePartialFrom(GtfsRealtime.java:216)
at com.google.protobuf.AbstractParser.parsePartialFrom(AbstractParser.java:192)
at com.google.protobuf.AbstractParser.parseFrom(AbstractParser.java:209)
at com.google.protobuf.AbstractParser.parseFrom(AbstractParser.java:215)
at com.google.protobuf.AbstractParser.parseFrom(AbstractParser.java:49)
at com.google.transit.realtime.GtfsRealtime$FeedMessage.parseFrom(GtfsRealtime.java:418)
at tfnsw.GetFerries.main(GetFerries.java:27)
Edit:
Exception from Ruby Client
/Users/nirving/.rvm/gems/ruby-2.1.9/gems/protobuf-3.6.7/lib/protobuf/decoder.rb:24:in `decode_each_field': 7 (Protobuf::InvalidWireType)
from /Users/nirving/.rvm/gems/ruby-2.1.9/gems/protobuf-3.6.7/lib/protobuf/message/serialization.rb:41:in `decode_from'
from /Users/nirving/.rvm/gems/ruby-2.1.9/gems/protobuf-3.6.7/lib/protobuf/message/serialization.rb:35:in `decode'
from /Users/nirving/.rvm/gems/ruby-2.1.9/gems/protobuf-3.6.7/lib/protobuf/message/serialization.rb:11:in `decode'
from /Users/nirving/.rvm/gems/ruby-2.1.9/gems/protobuf-3.6.7/lib/protobuf/field/message_field.rb:16:in `decode'
from /Users/nirving/.rvm/gems/ruby-2.1.9/gems/protobuf-3.6.7/lib/protobuf/field/base_field.rb:125:in `set'
from /Users/nirving/.rvm/gems/ruby-2.1.9/gems/protobuf-3.6.7/lib/protobuf/message/serialization.rb:80:in `set_field_bytes'
from /Users/nirving/.rvm/gems/ruby-2.1.9/gems/protobuf-3.6.7/lib/protobuf/message/serialization.rb:42:in `block in decode_from'
from /Users/nirving/.rvm/gems/ruby-2.1.9/gems/protobuf-3.6.7/lib/protobuf/decoder.rb:27:in `decode_each_field'
from /Users/nirving/.rvm/gems/ruby-2.1.9/gems/protobuf-3.6.7/lib/protobuf/message/serialization.rb:41:in `decode_from'
from /Users/nirving/.rvm/gems/ruby-2.1.9/gems/protobuf-3.6.7/lib/protobuf/message/serialization.rb:35:in `decode'
from /Users/nirving/.rvm/gems/ruby-2.1.9/gems/protobuf-3.6.7/lib/protobuf/message/serialization.rb:11:in `decode'
from /Users/nirving/.rvm/gems/ruby-2.1.9/gems/protobuf-3.6.7/lib/protobuf/field/message_field.rb:16:in `decode'
from /Users/nirving/.rvm/gems/ruby-2.1.9/gems/protobuf-3.6.7/lib/protobuf/field/base_field.rb:125:in `set'
from /Users/nirving/.rvm/gems/ruby-2.1.9/gems/protobuf-3.6.7/lib/protobuf/message/serialization.rb:80:in `set_field_bytes'
from /Users/nirving/.rvm/gems/ruby-2.1.9/gems/protobuf-3.6.7/lib/protobuf/message/serialization.rb:42:in `block in decode_from'
from /Users/nirving/.rvm/gems/ruby-2.1.9/gems/protobuf-3.6.7/lib/protobuf/decoder.rb:27:in `decode_each_field'
from /Users/nirving/.rvm/gems/ruby-2.1.9/gems/protobuf-3.6.7/lib/protobuf/message/serialization.rb:41:in `decode_from'
from /Users/nirving/.rvm/gems/ruby-2.1.9/gems/protobuf-3.6.7/lib/protobuf/message/serialization.rb:35:in `decode'
from /Users/nirving/.rvm/gems/ruby-2.1.9/gems/protobuf-3.6.7/lib/protobuf/message/serialization.rb:11:in `decode'
from /Users/nirving/.rvm/gems/ruby-2.1.9/gems/protobuf-3.6.7/lib/protobuf/field/message_field.rb:16:in `decode'
from /Users/nirving/.rvm/gems/ruby-2.1.9/gems/protobuf-3.6.7/lib/protobuf/field/base_field.rb:126:in `set'
from /Users/nirving/.rvm/gems/ruby-2.1.9/gems/protobuf-3.6.7/lib/protobuf/message/serialization.rb:80:in `set_field_bytes'
from /Users/nirving/.rvm/gems/ruby-2.1.9/gems/protobuf-3.6.7/lib/protobuf/message/serialization.rb:42:in `block in decode_from'
from /Users/nirving/.rvm/gems/ruby-2.1.9/gems/protobuf-3.6.7/lib/protobuf/decoder.rb:27:in `decode_each_field'
from /Users/nirving/.rvm/gems/ruby-2.1.9/gems/protobuf-3.6.7/lib/protobuf/message/serialization.rb:41:in `decode_from'
from /Users/nirving/.rvm/gems/ruby-2.1.9/gems/protobuf-3.6.7/lib/protobuf/message/serialization.rb:35:in `decode'
from /Users/nirving/.rvm/gems/ruby-2.1.9/gems/protobuf-3.6.7/lib/protobuf/message/serialization.rb:11:in `decode'
from ./gtfs.rb:14:in `<main>'
Edit:
Exception from Python Client
Traceback (most recent call last):
File "./gtfs.py", line 8, in <module>
feed.ParseFromString(result.read())
File "/Library/Python/2.7/site-packages/google/protobuf/message.py", line 186, in ParseFromString
self.MergeFromString(serialized)
File "/Library/Python/2.7/site-packages/google/protobuf/internal/python_message.py", line 841, in MergeFromString
if self._InternalParse(serialized, 0, length) != length:
File "/Library/Python/2.7/site-packages/google/protobuf/internal/python_message.py", line 874, in InternalParse
pos = field_decoder(buffer, new_pos, end, self, field_dict)
File "/Library/Python/2.7/site-packages/google/protobuf/internal/decoder.py", line 633, in DecodeRepeatedField
if value.add()._InternalParse(buffer, pos, new_pos) != new_pos:
File "/Library/Python/2.7/site-packages/google/protobuf/internal/python_message.py", line 874, in InternalParse
pos = field_decoder(buffer, new_pos, end, self, field_dict)
File "/Library/Python/2.7/site-packages/google/protobuf/internal/decoder.py", line 654, in DecodeField
if value._InternalParse(buffer, pos, new_pos) != new_pos:
File "/Library/Python/2.7/site-packages/google/protobuf/internal/python_message.py", line 874, in InternalParse
pos = field_decoder(buffer, new_pos, end, self, field_dict)
File "/Library/Python/2.7/site-packages/google/protobuf/internal/decoder.py", line 654, in DecodeField
if value._InternalParse(buffer, pos, new_pos) != new_pos:
File "/Library/Python/2.7/site-packages/google/protobuf/internal/python_message.py", line 866, in InternalParse
new_pos = local_SkipField(buffer, new_pos, end, tag_bytes)
File "/Library/Python/2.7/site-packages/google/protobuf/internal/decoder.py", line 827, in SkipField
return WIRETYPE_TO_SKIPPER[wire_type](buffer, pos, end)
File "/Library/Python/2.7/site-packages/google/protobuf/internal/decoder.py", line 797, in _RaiseInvalidWireType
raise _DecodeError('Tag had invalid wire type.')
google.protobuf.message.DecodeError: Tag had invalid wire type.