Re: [onebusaway-api] Seemingly random "Permission Denied" returns

117 views
Skip to first unread message

Sheldon A. Brown

unread,
Apr 24, 2013, 3:30:53 PM4/24/13
to onebusa...@googlegroups.com
I'm not quite sure if its completely implemented, but there are (at least) two reasons why the API keys exist:
1) to allow access (yes/no)
2) throttle access per user to protect the server resources

So yes, I suspect you are bumping into throttling.  Try adding some sleeps between consecutive calls to confirm.

I think the TEST API key is a special case as its used internally, and is allowed to exceed throttling limits.


If Brian or Denis see this message they can confirm....


On Tue, Apr 23, 2013 at 8:06 PM, Nathan Wolke <indus...@gmail.com> wrote:
I am making calls to "trips-for-route" with this:
 
If I make persistent calls every 30 seconds to one route, I haven't seen any issues. However, if I make a large number of calls to multiple route ID's, I will, almost always, get 1 or more of the returns as a 401 status, "Permission Denied". And it's never with the same route.
This can happen with 2 routes called to in series, or upwards of 8. I wonder if there is a server-side lockdown on numbers of calls made in a timespan or something? I would dig into the core code myself but I figure someone else has a better understanding than I do.
 
I should note: as a compare/contrast test, I replaced MYKEY with TEST and have NEVER seen any calls to the above url return 401.
 
I am continuing to diagnose my choice of framework to see if it's failing to send the key correctly but if anybody has any knowledge and advice/solutions on this, I would appreciate it.
 
Thanks!

--
You received this message because you are subscribed to the Google Groups "OneBusAway API" group.
To unsubscribe from this group and stop receiving emails from it, send an email to onebusaway-ap...@googlegroups.com.
To post to this group, send email to onebusa...@googlegroups.com.
Visit this group at http://groups.google.com/group/onebusaway-api?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Brian Ferris

unread,
Apr 25, 2013, 1:22:36 AM4/25/13
to onebusa...@googlegroups.com
Sheldon's summary is correct, based on my understanding of the API key system.

Nathan Wolke

unread,
Apr 26, 2013, 12:11:13 PM4/26/13
to onebusa...@googlegroups.com
That makes sense. I had already put in a sleep (around 500ms) and saw my returns never get bounced so indeed it must be throttled.
 
I'll play with the lowest delay I can get away with. It would be much nicer if "trips-for-location" worked, then I wouldn't have to do this for every route in my area and parse out those trips not literally in my area, but alas...
 
Thanks for confirming this though!

Cookie Guru

unread,
Apr 26, 2013, 12:28:12 PM4/26/13
to onebusa...@googlegroups.com

Depending on the architecture of your app, you can always test for a over limit return, and if you get that then sleep and request again,  otherwise continue processing data.

Nathan Wolke

unread,
Apr 26, 2013, 2:54:20 PM4/26/13
to onebusa...@googlegroups.com
I'm curious how that would work when the "limitExceeded" field isn't even returned? It exists in the "data" element and that is null on a 401. Or would it be safe to assume a 401 return means it's throttled?

cooki...@gmail.com

unread,
Apr 26, 2013, 4:02:26 PM4/26/13
to onebusa...@googlegroups.com
I would say that 401 is a safe assumption that you're throttled, be it
temporary or permanently. When Brian wrote the API, he kept close to
the standard HTTP status codes:
http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html

It would be wise to limit the number of retries so your app isn't stuck
in an infinite loop. However, adding a small sleep is still a good idea
if you're frequently getting locked out.

--Tim

On 4/26/2013 11:54, Nathan Wolke wrote:
> I'm curious how that would work when the "limitExceeded" field isn't
> even returned? It exists in the "data" element and that is null on a
> 401. Or would it be safe to assume a 401 return means it's throttled?
>
> On Friday, April 26, 2013 9:28:12 AM UTC-7, Tim wrote:
>
> Depending on the architecture of your app, you can always test for a
> over limit return, and if you get that then sleep and request
> again, otherwise continue processing data.
>
> On Apr 26, 2013 9:11 AM, "Nathan Wolke" <indus...@gmail.com
> <javascript:>> wrote:
>
> That makes sense. I had already put in a sleep (around 500ms)
> and saw my returns never get bounced so indeed it must be throttled.
> I'll play with the lowest delay I can get away with. It would be
> much nicer if "trips-for-location" worked, then I wouldn't have
> to do this for every route in my area and parse out those trips
> not literally in my area, but alas...
> Thanks for confirming this though!
>
> On Wednesday, April 24, 2013 12:30:53 PM UTC-7, Sheldon A. Brown
> wrote:
>
> I'm not quite sure if its completely implemented, but there
> are (at least) two reasons why the API keys exist:
> 1) to allow access (yes/no)
> 2) throttle access per user to protect the server resources
>
> So yes, I suspect you are bumping into throttling. Try
> adding some sleeps between consecutive calls to confirm.
>
> I think the TEST API key is a special case as its used
> internally, and is allowed to exceed throttling limits.
>
>
> If Brian or Denis see this message they can confirm....
>
>
> On Tue, Apr 23, 2013 at 8:06 PM, Nathan Wolke
> <indus...@gmail.com> wrote:
>
> I am making calls to "trips-for-route" with this:
> http://api.onebusaway.org/api/__where/trips-for-route/1_244.__json?key=MYKEY
> onebusaway-ap...@__googlegroups.com.
> To post to this group, send email to
> onebusa...@googlegroups.__com.
> Visit this group at
> http://groups.google.com/__group/onebusaway-api?hl=en
> <http://groups.google.com/group/onebusaway-api?hl=en>.
> For more options, visit
> https://groups.google.com/__groups/opt_out
> <https://groups.google.com/groups/opt_out>.
>
>
>
> --
> You received this message because you are subscribed to the
> Google Groups "OneBusAway API" group.
> To unsubscribe from this group and stop receiving emails from
> it, send an email to onebusaway-ap...@googlegroups.com
> <javascript:>.
> To post to this group, send email to onebusa...@googlegroups.com
> <javascript:>.
> <http://groups.google.com/group/onebusaway-api?hl=en>.
> For more options, visit https://groups.google.com/groups/opt_out
> <https://groups.google.com/groups/opt_out>.
Reply all
Reply to author
Forward
0 new messages