ipinfo / perl Goto Github PK
View Code? Open in Web Editor NEWOfficial Perl client library for IPinfo API (IP geolocation and other types of IP data)
Home Page: https://ipinfo.io
Official Perl client library for IPinfo API (IP geolocation and other types of IP data)
Home Page: https://ipinfo.io
Add an optional IP selection handler to the SDK client initialization step which accepts the request context and expects returning an IP.
Add a default handler for this which looks at the X-Forwarded-For
header and falls back to the source IP.
The resulting IP is the IP for which details are fetched.
https://ipinfo.io/developers/batch
Take into account use cases like ipinfo/python#35 to ensure batch ops support is scalable & robust.
We have several files like eu.json, countries.json, continents.json and so on, which are loaded during initialization / startup of the client.
Instead of loading these as such, which has risks such as the asset not appearing in a production environment properly, and has a performance penalty during init of loading an on-disk file, we should inline the files into a static, in-memory map / dictionary or similar.
when using Geo::IPinfo the method info return the right detailed object but it unnecessarily print it to console.
I end with plenty of
{
"ip": "202.3.225.115",
"city": "Papeete",
"region": "Îles du Vent",
"country": "PF",
"loc": "-17.5373,-149.5665",
"timezone": "Pacific/Tahiti"
}
on the screen instead of just populating my variables.
is it possible to stop this printing ?
The library essentially queries https://ipinfo.io//geo
when we call the function without an IP input, and this endpoint (with the 2 slashes before geo
) gives a 404. Likely we changed this behavior in the API at some point so it broke the Perl SDK which didn't have this problem before.
Just a simple fix of not accidentally adding an extra slash is needed.
Implement SDK support for IP summaries.
The field
routine uses valid_fields
to determine what a valid field is, and some of the paid fields aren't included in there, so we should add them to it.
Make sure the cache key contains a number to indicate the version of the cached data. Data changes that change what's expected in cached data require a version change.
Create a simple function that accepts an IP list (max 500k) and returns the JSON response from https://ipinfo.io/tools/map
. See the web page on https://ipinfo.io/tools/map for more details.
Add an optional IP selection handler to the SDK client initialization step which accepts the request context and expects returning an IP.
Add a default handler for this which looks at the X-Forwarded-For
header and falls back to the source IP.
The resulting IP is the IP for which details are fetched.
I try to execute the following example present in the documentation:
use Geo::IPinfo;
$ipinfo = Geo::IPinfo->new();
$details = $ipinfo->info('8.8.8.8');
if (defined $details) # valid data returned
{
$city = $details->city; # Emeryville
$loc = $details->loc; # 37.8342,-122.2900
}
else # invalid data obtained, show error message
{
print $ipinfo->error_msg . "\n";
}
but without a token the library fails at line 47.
It is possible fix it?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.