服务器响应状态为 429 (Too Many Requests) intlTelInput.js

2022-01-14 00:00:00 geolocation jquery javascript

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

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

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

因为这个工作没有javascript代码.这可能是什么原因?

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

推荐答案

在此处查看速率限制:https://ipinfo.io/开发人员

您每天限制为 1,000 个 API 请求.如果您需要发出更多请求或需要 SSL 支持,请参阅我们的付费计划."

"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."

我认为您需要为更多请求付费,或者想办法减少您提出的请求.您可能可以缓存该位置,因此您只需使用本地存储为每个用户查询一次.

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.

相关文章