Use an SDK
Install an InternetData client library, look up an address, an AS and a domain from your own code, then pass a key from an environment variable.
On this page
Each official library wraps the same API, retries a 429, caches answers and types every field. Install one:
npm install @internetdata/internetdatapip install internetdatago get github.com/internetdata/sdk-go/v2composer require internetdata/internetdatagem install internetdatadotnet add package InternetDatacargo add internetdataJava's Maven and Gradle coordinates are on its page.
Look an address up
No key is needed to start:
import { InternetData } from '@internetdata/internetdata';
const client = new InternetData();
const result = await client.lookup('8.8.8.8');
console.log(result.location.country); // US
console.log(result.company.name); // Google LLCfrom internetdata import InternetData
with InternetData() as client:
result = client.lookup("8.8.8.8")
print(result.location.country) # US
print(result.asn.name) # Google LLCclient, err := internetdata.New()
if err != nil {
log.Fatal(err)
}
result, err := client.Lookup(ctx, "8.8.8.8")
if err != nil {
log.Fatal(err)
}
fmt.Println(result.Location.Country) // USuse InternetData\Client;
$client = new Client();
$result = $client->lookup('8.8.8.8');
echo $result->location->country; // US
echo $result->asn->name; // Google LLCrequire 'internetdata'
client = InternetData::Client.new
result = client.lookup('8.8.8.8')
result.location['country'] # => "US"
result.asn['name'] # => "Google LLC"using InternetData;
using var client = new InternetDataClient();
var result = await client.LookupAsync("8.8.8.8");
Console.WriteLine(result.Location.Country); // US
Console.WriteLine(result.Asn.Name); // Google LLCuse internetdata::Client;
let client = Client::new()?;
let result = client.lookup("8.8.8.8").await?;
println!("{}", result.location.country); // USAn AS and a domain have their own calls:
const asn = await client.lookupAsn(15169);
console.log(asn.name); // Google LLC
const domain = await client.lookupDomain('example.com');
console.log(domain.isRegistered); // trueasn = client.lookup_asn(15169)
print(asn.name) # Google LLC
domain = client.lookup_domain("example.com")
print(domain.is_registered, domain.has_mx) # True TruePass a key
A key widens the answer. Read it from the environment so it never lands in your repository:
export INTERNETDATA_API_KEY="YOUR_API_KEY"const client = new InternetData({ apiKey: process.env.INTERNETDATA_API_KEY });import os
client = InternetData(os.environ["INTERNETDATA_API_KEY"])Each library's page has its own way to pass one, and the rest of what it does: batches, your plan and usage, the databases and errors.