Skip to content

Commit 90d6a08

Browse files
committed
Update README.md with minimal instructions to use Lite API
1 parent 5fe6a57 commit 90d6a08

1 file changed

Lines changed: 22 additions & 5 deletions

File tree

README.md

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,18 @@
22

33
This is the official Python client library for the IPinfo.io IP address API, allowing you to look up your own IP address, or get any of the following details for an IP:
44

5-
- [IP geolocation](https://ipinfo.io/ip-geolocation-api) (city, region, country, postal code, latitude, and longitude)
6-
- [ASN details](https://ipinfo.io/asn-api) (ISP or network operator, associated domain name, and type, such as business, hosting, or company)
7-
- [Firmographics data](https://ipinfo.io/ip-company-api) (the name and domain of the business that uses the IP address)
8-
- [Carrier information](https://ipinfo.io/ip-carrier-api) (the name of the mobile carrier and MNC and MCC for that carrier if the IP is used exclusively for mobile traffic)
5+
- [IP geolocation](https://ipinfo.io/ip-geolocation-api) (city, region, country, postal code, latitude, and longitude)
6+
- [ASN details](https://ipinfo.io/asn-api) (ISP or network operator, associated domain name, and type, such as business, hosting, or company)
7+
- [Firmographics data](https://ipinfo.io/ip-company-api) (the name and domain of the business that uses the IP address)
8+
- [Carrier information](https://ipinfo.io/ip-carrier-api) (the name of the mobile carrier and MNC and MCC for that carrier if the IP is used exclusively for mobile traffic)
99

1010
## Getting Started
1111

1212
You'll need an IPinfo API access token, which you can get by signing up for a free account at [https://ipinfo.io/signup](https://ipinfo.io/signup).
1313

1414
The free plan is limited to 50,000 requests per month, and doesn't include some of the data fields such as IP type and company data. To enable all the data fields and additional request volumes see [https://ipinfo.io/pricing](https://ipinfo.io/pricing)
1515

16-
⚠️ Note: This library does not currently support our newest free API https://ipinfo.io/lite. If you’d like to use IPinfo Lite, you can call the [endpoint directly](https://ipinfo.io/developers/lite-api) using your preferred HTTP client. Developers are also welcome to contribute support for Lite by submitting a pull request.
16+
The library also supports the Lite API, see the [Lite API section](#lite-api) for more info.
1717

1818
### Installation
1919

@@ -162,6 +162,22 @@ The IPinfo library can be authenticated with your IPinfo API token, which is pas
162162
'timezone': 'America/Los_Angeles'}
163163
```
164164

165+
### Lite API
166+
167+
The library gives the possibility to use the [Lite API](https://ipinfo.io/developers/lite-api) too, authentication with your token is still required.
168+
169+
The returned details are slightly different from the Core API.
170+
171+
```python
172+
>>> import ipinfo
173+
>>> handler = ipinfo.getHandlerLite(access_token='123456789abc')
174+
>>> details = handler.getDetails("8.8.8.8")
175+
>>> details.country_code
176+
'US'
177+
>>> details.country
178+
'United States'
179+
```
180+
165181
### Caching
166182

167183
In-memory caching of `details` data is provided by default via the [cachetools](https://cachetools.readthedocs.io/en/latest/) library. This uses an LRU (least recently used) cache with a TTL (time to live) by default. This means that values will be cached for the specified duration; if the cache's max size is reached, cache values will be invalidated as necessary, starting with the oldest cached value.
@@ -297,6 +313,7 @@ When looking up an IP address, the response object includes `details.country_nam
297313
continents=continents
298314
)
299315
```
316+
300317
### Batch Operations
301318

302319
Looking up a single IP at a time can be slow. It could be done concurrently

0 commit comments

Comments
 (0)