Daily usage limits for unauthenticated use?

4,797 views
Skip to first unread message

Alejandro Pena

unread,
Oct 12, 2017, 8:47:03 PM10/12/17
to Google Civic Information API
I am using the Google Civic Information for a Django app that will take user input and redirect the user according to whether or not he/she lives in Texas House District 51. I keep receiving the same error although I'm not even close to exceeding my daily quota (four requests, four errors). Do you have any insight into what is causing the error and how it might be remedied? I receive the same error regardless of whether I use Django's development server or Heroku. I think the problem might have to do with my HTTP request's headers, although I'm not sure how to fix it. I'm using an API key to authenticate the request and don't believe I should have to use Oauth for this use case.

Many thanks,
Alejandro Peña

{'error': {'code': 403,
'errors': [{'domain': 'usageLimits',
'extendedHelp': 'https://code.google.com/apis/console',
'message': 'Daily Limit for Unauthenticated Use '
'Exceeded. Continued use requires signup.',
'reason': 'dailyLimitExceededUnreg'}],
'message': 'Daily Limit for Unauthenticated Use Exceeded. Continued '
'use requires signup.'}}

def process_form(request):
if request.method == 'POST':
# create a form instance and populate it with data from the request:
form = AddressForm(request.POST)
# check whether it's valid:
if form.is_valid():
# process the data in form.cleaned_data as required
chunk = []
raw_address = form.cleaned_data['your_address']
for x in raw_address:
if x != " ":
chunk.append(x)
elif x == " ":
chunk.append("+")
else:
pass

key = "<your key>"
url = "https://www.googleapis.com/civicinfo/v2/representatives?address=" + "".join(
chunk) + "&includeOffices=true&key=" + key
# Need to add error handling
contents = requests.get(url)
data = contents.json()

lowerHouse = data['offices'][7]['name']
if lowerHouse == "TX State House District 51":
return redirect('welcome/')
else:
return HttpResponse('Sorry, you do not live in HD51!')

Cong Chen

unread,
Oct 13, 2017, 1:33:14 PM10/13/17
to Google Civic Information API
Hi Alejandro,

Thanks for reaching out. Wonder if you've tried directly on browser via https://www.googleapis.com/civicinfo/v2/representatives?address={your_input_address}&key={YOUR_API_KEY}. Are you getting the same error? also, is your key restricted in anyways? if so, please make sure that you're initiating the request from the correct/expected site, app, or IP addresses.

Thanks,
Cong


Cong Chen | Partner Technology Manager | cong...@google.com | 212-565-8800



--
You received this message because you are subscribed to the Google Groups "Google Civic Information API" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-civicinfo-api+unsubscrib...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Jackie Kazil

unread,
Jun 27, 2018, 1:54:07 AM6/27/18
to Google Civic Information API
I am running into the same error. My key works in the browser, but not after 50 or 60 requests from the command line. I get the same error. 
How was this resolved? 

-Jackie

Robert Baskin

unread,
Jul 25, 2018, 9:41:20 AM7/25/18
to Google Civic Information API
Hi Jackie,
Would you mind sharing a but more info about the specific errors? 
Additionally, please take a look here: https://developers.google.com/civic-information/docs/v2/standard_errors 

-Rob

Jackie Kazil

unread,
Jul 25, 2018, 10:19:23 AM7/25/18
to Google Civic Information API
The issue was resolved by enabling my API key -- Enable the API to work with your key
Reply all
Reply to author
Forward
0 new messages