You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Are there examples available that show how to use the API? I am trying to use the PS06 API and receiving very strange error messages from MarineTraffic:
Traceback (most recent call last):
File "mttest-1.py", line 36, in <module>
time_span=10)
File "mttest-1.py", line 23, in ps06_Vessel_Positions_in_a_Predefined_Area
msg_type="simple")
File "/usr/local/lib/python3.7/site-packages/marinetrafficapi/bind.py", line 204, in call
return request.call()
File "/usr/local/lib/python3.7/site-packages/marinetrafficapi/bind.py", line 188, in call
return self._process_response(status_code, response)
File "/usr/local/lib/python3.7/site-packages/marinetrafficapi/bind.py", line 173, in _process_response
raise MarineTrafficRequestApiException(msg)
marinetrafficapi.exceptions.MarineTrafficRequestApiException: Request errors: code 5a2: INSUFFICIENT CREDITS. You currently have 13 credits while 84699 is/are required to fulfil this API call. You can purchase additional credits at: https://www.marinetraffic.com/en/online-services/marinetraffic-credits
The request I am making only costs a few credits with a simple query, and about 52 credits for an extended query, nowhere near 84699 credits! My code is pretty simple:
and if I manually create the URL request string in the browser for PS06, I get back sensible data at a sensible cost. One other thing I had to do was to cast the latitude, longitude and time_span variables to strings; if I tried to pass them without casting to strings, I would get runtime exceptions like this:
Traceback (most recent call last):
File "mttest-1.py", line 35, in <module>
time_span=10)
File "mttest-1.py", line 22, in ps06_Vessel_Positions_in_a_Predefined_Area
time_span)
File "/usr/local/lib/python3.7/site-packages/marinetrafficapi/bind.py", line 204, in call
return request.call()
File "/usr/local/lib/python3.7/site-packages/marinetrafficapi/bind.py", line 186, in call
self.url = self._prepare_url()
File "/usr/local/lib/python3.7/site-packages/marinetrafficapi/bind.py", line 106, in _prepare_url
self.parameters[RequestConst.PATH]])
TypeError: sequence item 0: expected str instance, float found
I am running Python 3.7.7 on OS X Mojave (10.14.6).
The text was updated successfully, but these errors were encountered:
MSBGit
changed the title
Example code available?
Example code available? Strange runtime errors for API cost and casting to strings.
Oct 6, 2020
Are there examples available that show how to use the API? I am trying to use the PS06 API and receiving very strange error messages from MarineTraffic:
The request I am making only costs a few credits with a simple query, and about 52 credits for an extended query, nowhere near 84699 credits! My code is pretty simple:
and if I manually create the URL request string in the browser for PS06, I get back sensible data at a sensible cost. One other thing I had to do was to cast the latitude, longitude and time_span variables to strings; if I tried to pass them without casting to strings, I would get runtime exceptions like this:
I am running Python 3.7.7 on OS X Mojave (10.14.6).
The text was updated successfully, but these errors were encountered: