javascript 服务器以 429(请求过多)的状态响应 intlTelInput.js

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/31704941/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-28 14:13:31  来源:igfitidea点击:

the server responded with a status of 429 (Too Many Requests) intlTelInput.js

javascriptjquerygeolocation

提问by Anahit DEV

I am using intlTelInput.min.js for geo IP lookup with this code

我正在使用 intlTelInput.min.js 使用此代码进行地理 IP 查找

jQuery("#teephnumber").intlTelInput({
        allowExtensions: true,
        defaultCountry: "auto",
        setNumber: "Telephone number",
        geoIpLookup: function(callback) {
            $.get('http://ipinfo.io', function() {}, "jsonp").always(function(resp) {
              var countryCode = (resp && resp.country) ? resp.country : "";
              callback(countryCode);
            });
          },
        nationalMode: false,
        utilsScript: "/wp-content/themes/imc/js/utils.js"
    });

it was working fine, but now not in console I see this error:

它工作正常,但现在不在控制台中,我看到此错误:

The server responded with a status of 429 (Too Many Requests), GET http://ipinfo.io/?callback=jQuery1112025137682701461017_1438183879450&_=1438183879451

And no javascript code because of this works.What can be the reason for this?

并且没有 javascript 代码,因为这个作品。这可能是什么原因?

采纳答案by DonutReply

See Rate limits here: https://ipinfo.io/developers

请参阅此处的速率限制:https: //ipinfo.io/developers

"You are limited to 1,000 API requests per day. If you need to make more requests, or need SSL support, see our paid plans."

“您每天仅限于 1,000 个 API 请求。如果您需要发出更多请求,或需要 SSL 支持,请参阅我们的付费计划。”

I think you need to pay for more requests or find a way to reduce the requests you are making. You can probably cache the location so you only query once per user using localstorage.

我认为您需要为更多请求付费或找到一种方法来减少您提出的请求。您可能可以缓存该位置,以便每个用户使用 localstorage 仅查询一次。