@@ -83,64 +83,92 @@ additional configuration as demonstrated below:
8383{{< codeset >}}
8484
8585``` csharp
86- var client = new WebServiceClient (10 , " LICENSEKEY" );
86+ int accountId = 10 ;
87+ string licenseKey = " LICENSEKEY" ;
8788
88- // To query the GeoLite web service, you must set the optional `host` parameter
89- to `geolite .info `
90- var client = new WebServiceClient (10 , " LICENSEKEY" , host : " geolite.info" );
89+ var client = new WebServiceClient (accountId , licenseKey );
9190
91+ // To query the GeoLite web service, you must set the optional `host` parameter
92+ // to `geolite.info`
93+ var client = new WebServiceClient (accountId , licenseKey , host : " geolite.info" );
9294```
9395
9496``` java
95- WebServiceClient client = new WebServiceClient .Builder (10 , " LICENSEKEY" ). build();
97+ int accountId = 10 ;
98+ String licenseKey = " LICENSEKEY" ;
99+
100+ WebServiceClient client = new WebServiceClient .Builder (accountId, licenseKey). build();
96101
97102// To query the GeoLite web service, you must call the `host` method on the
98103// builder with "geolite.info"
99- WebServiceClient client = new WebServiceClient .Builder (10 , " LICENSEKEY" ). host(" geolite.info" ). build();
104+ WebServiceClient client = new WebServiceClient .Builder (accountId, licenseKey)
105+ .host(" geolite.info" ). build();
100106```
101107
102108``` javascript
103- const client = new WebServiceClient (' 10' , ' LICENSEKEY' );
109+ const WebServiceClient = require (' @maxmind/geoip2-node' ).WebServiceClient ;
110+ // TypeScript:
111+ // import { WebServiceClient } from '@maxmind/geoip2-node';
112+
113+ const accountId = ' 10' ;
114+ const licenseKey = ' LICENSEKEY' ;
115+
116+ const client = new WebServiceClient (accountId, licenseKey);
104117
105118// To query the GeoLite web service, you must set the optional `host` parameter
106- const client = new WebServiceClient (' 10 ' , ' LICENSEKEY ' , {
119+ const client = new WebServiceClient (accountId, licenseKey , {
107120 host: ' geolite.info' ,
108121});
109122```
110123
111124``` php
112- $client = new Client(10, 'LICENSEKEY');
125+ <?php require_once 'vendor/autoload.php'
126+ use GeoIp2\WebService\Client;
127+
128+ $account_id = 10;
129+ $license_key = 'LICENSEKEY';
130+
131+ $client = new Client($account_id, $license_key);
113132
114133// To query the GeoLite web service, you must set the optional `host` argument.
115134// The third argument specifies the language preferences when using the `->name`
116135// method on the model classes that this client creates.
117- $client = new Client(10, 'LICENSEKEY' , ['en'], ['host' => 'geolite.info']);
136+ $client = new Client($account_id, $license_key , ['en'], ['host' => 'geolite.info']);
118137```
119138
120139``` python
140+ import asyncio # for async requests with AsyncClient
141+ import geoip2.webservice
142+
143+ account_id = 10
144+ license_key = ' LICENSEKEY'
145+
121146# If you want to use synchronous requests
122- client = Client(10 , ' LICENSEKEY' );
147+ client = Client(account_id, license_key)
148+
123149# To query the GeoLite web service, you must set the "host" keyword argument
124150# to "geolite.info"
125- client = Client(10 , ' LICENSEKEY ' , host = ' geolite.info' );
151+ client = Client(account_id, license_key , host = ' geolite.info' )
126152
127153# Or if you want to use asynchronous requests
128- async_client = AsyncClient(10 , ' LICENSEKEY ' ) ;
154+ async_client = AsyncClient(account_id, license_key)
129155
130156# To query the GeoLite web service, you must set the "host" keyword argument
131157# to "geolite.info"
132- async_client = AsyncClient(10 , ' LICENSEKEY ' , host = ' geolite.info' );
158+ async_client = AsyncClient(account_id, license_key , host = ' geolite.info' )
133159```
134160
135161``` ruby
136- Minfraud .configure do |c |
137- c.account_id = 10
138- c.license_key = ' LICENSEKEY'
162+ require ' maxmind/geoip2'
163+
164+ client = MaxMind ::GeoIP2 ::Client .new (
165+ account_id: 10 ,
166+ license_key: ' LICENSEKEY' ,
139167
140168 # To use the GeoLite web service instead of GeoIP, set the host
141169 # parameter to "geolite.info", eg:
142- # host: 'geolite.info'
143- end
170+ # host: 'geolite.info',
171+ )
144172```
145173
146174{{< /codeset >}}
@@ -158,8 +186,11 @@ method for accessing the desired geolocation service.
158186// should be shared across requests to allow connection reuse. The
159187// class is thread safe.
160188
189+ int accountId = 10 ;
190+ string licenseKey = " LICENSEKEY" ;
191+
161192// Sync
162- using (var client = new WebServiceClient (10 , " license_key " ))
193+ using (var client = new WebServiceClient (accountId , licenseKey ))
163194{
164195 // You can also use `client.City` or `client.Insights`
165196 // `client.Insights` is not available to GeoLite users
@@ -171,7 +202,7 @@ using (var client = new WebServiceClient(10, "license_key"))
171202 }
172203
173204// Async
174- using (var client = new WebServiceClient (10 , " license_key " ))
205+ using (var client = new WebServiceClient (accountId , licenseKey ))
175206{
176207 // You can also use `client.CityAsync` or `client.InsightsAsync`
177208 // `client.InsightsAsync` is not available to GeoLite users
@@ -184,7 +215,10 @@ using (var client = new WebServiceClient(10, "license_key"))
184215```
185216
186217``` java
187- try (WebServiceClient client = new WebServiceClient .Builder (42 , " license_key" )
218+ int accountId = 10 ;
219+ String licenseKey = " LICENSEKEY" ;
220+
221+ try (WebServiceClient client = new WebServiceClient .Builder (accountId, licenseKey)
188222 .build()) {
189223
190224 InetAddress ipAddress = InetAddress . getByName(" 128.101.101.101" );
@@ -216,7 +250,10 @@ client.country('142.1.1.1').then((response) => {
216250<?php require_once 'vendor/autoload.php'
217251use GeoIp2\WebService\Client;
218252
219- $client = new Client(10, 'LICENSEKEY');
253+ $account_id = 10;
254+ $license_key = 'LICENSEKEY';
255+
256+ $client = new Client($account_id, $license_key);
220257
221258// You can also use `$client->city` or `$client->insights`
222259// `$client->insights` is not available to GeoLite users
@@ -229,7 +266,10 @@ print($record->country->isoCode . "\n");
229266# Sync
230267import geoip2.webservice
231268
232- with geoip2.webservice.Client(10 , ' license_key' ) as client:
269+ account_id = 10
270+ license_key = ' LICENSEKEY'
271+
272+ with geoip2.webservice.Client(account_id, license_key) as client:
233273 # You can also use `client.city` or `client.insights`
234274 # `client.insights` is not available to GeoLite users
235275 response = client.country(' 128.101.101.101)
@@ -241,7 +281,7 @@ import asyncio
241281import geoip2.webservice
242282
243283async def main():
244- async with geoip2.webservice.AsyncClient(10 , ' license_key' ) as client:
284+ async with geoip2.webservice.AsyncClient(account_id, license_key) as client:
245285 # You can also use `client.city` or `client.insights`
246286 # `client.insights` is not available to GeoLite users
247287 response = await client.country(' 128.101.101.101)
@@ -254,13 +294,13 @@ asyncio.run(main())
254294```ruby
255295require ' maxmind/geoip2'
256296
257- Minfraud.configure do | c |
258- c. account_id = 10
259- c. license_key = ' LICENSEKEY'
260- end
297+ client = MaxMind::GeoIP2::Client.new(
298+ account_id: 10 ,
299+ license_key: ' LICENSEKEY' ,
300+ )
261301
262- # You can also use `client.city` or `client.insights`
263- # `client.insights` is not available to GeoLite users
302+ # You can also use `client.city` or `client.insights`.
303+ # Note that `client.insights` is not available to GeoLite users.
264304record = client.country(' 128.101.101.101' )
265305
266306puts record.country.iso_code
0 commit comments