使用个人API密钥设置Rails Geocoder [英] Setting up Rails Geocoder with Personal API Key

查看:120
本文介绍了使用个人API密钥设置Rails Geocoder的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Rails Geocoder表示不要使用Key for Free版本,而只需使用Premier的密钥。我所维护的网站似乎超过了限制,所以我设置了一个新的api密钥并启用了结算功能。

我设置了我的initilizer因此

  Geocoder.configure(
:timeout => 5,
:lookup =>:google,
:api_key =>输入我的钥匙在这里,
:units =>:mi

我在我的日志中获得拒绝的请求。当我删除文件时,它使用地理编码器默认配置并工作。但是,如果我超过了限度,我的早晨就会停止工作。我没有设立一个总理帐户,而是假设我们只是要收取差额而启用计费。我想我每1000个请求读取0.50美元。有任何想法吗?

解决方案

缓存您的地理编码请求,它会为您节省一些钱(希望),并加速您的应用程序(当然) / p>

  Geocoder.configure(
#...
:cache => Redis.current


Rails Geocoder says not to use Key for Free version, to instead only use the key for Premier. The site i'm maintaining seems to be going over the limit not, so I set up a new api key and enabled billing.

I setup my initilizer like so

     Geocoder.configure(
    :timeout  => 5,
    :lookup   => :google,
    :api_key  => "ENTERED MY KEY HERE",
    :units    => :mi
    )

I Get a REQUEST DENIED in my logs. When I delete the file it uses geocoders default config and works. But my the morning it will stop working, assuming I'm going over the limit. Rather than setting up a Premier account, I enabled billing assuming we would just be charged the difference. I think I read $.50 per 1000 requests. Any Ideas?

解决方案

Cache your geocoding requests, it will save you some bucks (hopefully) and speed up your app (for sure).

Geocoder.configure(
  # ...
  :cache => Redis.current
)

这篇关于使用个人API密钥设置Rails Geocoder的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆