2017-04-22 7 views
0

GoogleシティAPI https://developers.google.com/civic-information/docs/v2/representatives/representativeInfoByAddressrepresentativeInfoByAddresを使用してデータをリクエストしようとしていますが、​​に電話するとエラーが発生します。GoogleのシビックAPIを使用しているHttpError

from apiclient.discovery import build 
add = "24783 Oakwood Circle Anaheim CA 92801" 
service = build('civicinfo','v2', developerKey="key")    
rep = service.representatives().representativeInfoByAddress(address = add) 
response = rep.execute() 

戻り

--------------------------------------------------------------------------- 
HttpError         Traceback (most recent call last) 
<ipython-input-82-9fe54b12a47f> in <module>() 
     2 service = build('civicinfo','v2', developerKey="drog") 
     3 rep = service.representatives().representativeInfoByAddress(address = no) 
----> 4 response = rep.execute() 

/Users/dany_user/anaconda/lib/python2.7/site-packages/oauth2client/_helpers.pyc in positional_wrapper(*args, **kwargs) 
    131     elif positional_parameters_enforcement == POSITIONAL_WARNING: 
    132      logger.warning(message) 
--> 133    return wrapped(*args, **kwargs) 
    134   return positional_wrapper 
    135 

/Users/dany_user/anaconda/lib/python2.7/site-packages/googleapiclient/http.pyc in execute(self, http, num_retries) 
    838  callback(resp) 
    839  if resp.status >= 300: 
--> 840  raise HttpError(resp, content, uri=self.uri) 
    841  return self.postproc(resp, content) 
    842 

HttpError: <HttpError 403 when requesting https://www.googleapis.com/civicinfo/v2/representatives?alt=json&key=drog&address=24783+Oakwood+Circle+Anaheim+CA+92801 returned "Project 897797812785 is not found and cannot be used for API calls."> 

私が間違って何をしているのですか?

答えて

1

問題は、APIを有効にする必要があることです。

https://console.developers.google.comにアクセスし、希望するAPIを有効にしていることを「API」に設定してください。

関連する問題