Alright, I figured it out...

The problem is I am using basic access authentication (I know.. my
bad... OAuth it is... I swear I will switch to that...). But C#
HttpWebRequest doesn't pack up the basic access Authentication
credential into the headers unless you program it to. Therefore the
GET calls from my program goes unauthenticated and falls into the
quota of my IP.

here are three links helped me:

the trick in the last link works. MAKE SURE to attach "Basic" in front
of your Base64 string of username/password pair in your header
value!!!! I came up with the same workaround but missed that piece,
and I almost thought it didn't work until I found my problem by
reading the last link....

Now all my calls is counted against my account quota. Nice.


On Jun 21, 10:52 am, Jian Lu <> wrote:
> I have whitelisted my account (but no ip), and am sending requests
> through my desktop application by wrapping my credentials with C#
> HttpRequest.
> Very frequently, using the method above, I see my rates drop back to
> 150/hour and it drains out even I am not making any calls. Here is a
> sample reponse I got by checking my rate limit:
> {
>     remaining_hits = 0,
>     hourly_limit = 150,
>     reset_time_in_seconds = 1277141653,
>     reset_time = "Mon Jun 21 17:34:13 +0000 2010"
> }
> But strangely if I submit my rate-checking request on the SAME MACHINE
> at the SAME TIME through curl, I got the correct limit, and it doesn't
> automatically drain out if I don't make api request:
> {"reset_time_in_seconds":1277145186,"remaining_hits":
> 20000,"reset_time":"Mon Jun 21 18:33:06 +0000 2010","hourly_limit":
> 20000}
> The pattern I am seeing is:
> 1a. Right after limit RESET, if I query my rate limit through my C#
> HttpRequest code, I get my whitelisted rates. BUT it drains out
> automatically and quickly even I am not using it at all...
> 1b. But if I use curl to do a query to check my rate limit, even
> though the checking in #1a shows something lower than my real usage,
> the result returned from curl is always correct and equal to my real
> usage.
> 3. When that limit drains out, I started to get the 150/hour limit
> response but the remaining hits is 0 by issuing C# HttpRequests.
> What I suspected is it has something to do with my network setting. I
> am behind my company domain and maybe different machines within my
> company network have the same external IP?
> Is there any way to avoid that?
> -Jian

Reply via email to