|
1 | 1 |
|
2 | 2 |
|
3 | | -# [ipapi](https://ipapi.co/) Python Library |
| 3 | +# ipapi Python Library ~ [ipapi.co](https://ipapi.co/) by Kloudend, Inc. |
4 | 4 | ## IP Address Location | IP Lookup | IP Geolocation API |
5 | | -### by Kloudend, Inc. |
6 | 5 |
|
7 | 6 | The ipapi Python library provides convenient access to the IP address location service from applications written in the Python language. It makes it easy to harness the potential of the IP geolocation API. |
8 | 7 |
|
9 | | -The service is powered by https://ipapi.co/ and owned by Kloudend, Inc. |
| 8 | +Details on [free IP lookup](https://ipapi.co/free/) and [ipapi pricing plans](https://ipapi.co/pricing/) |
10 | 9 |
|
11 | 10 | ## Documentation |
12 | | -See the [ipapi API docs]([https://ipapi.co/api/?python#location-of-clients-ip](https://ipapi.co/api/?python#location-of-clients-ip)) |
| 11 | +See the [ipapi API docs](https://ipapi.co/api/?python#location-of-clients-ip) |
13 | 12 |
|
14 | 13 | ## Installation |
15 | 14 |
|
@@ -46,21 +45,22 @@ import ipapi |
46 | 45 |
|
47 | 46 | ipapi.location(ip, key, output) |
48 | 47 | ``` |
| 48 | +### [Options](#options) |
49 | 49 | |Argument|Description | |
50 | 50 | |--|--| |
51 | | -|`ip`| IP Address that you wish to locate.<br>If omitted, it defaults to the your machine's IP | |
| 51 | +|`ip`| IP Address (IPv4 or IPv6) that you wish to locate.<br>If omitted, it defaults to the your machine's IP | |
52 | 52 | |`key`| API key (for paid plans).<br>Omit it or set key=`None` for usage under [free IP Location]([https://ipapi.co/free/](https://ipapi.co/free/)) tier. | |
53 | 53 | |`output`| The desired output from the API. <br>For complete IP location object, valid values are `json`, `csv`, `xml`, `yaml`.<br>To retrieve a specific field (e.g. city, country etc. as text), valid values are [1].<br>If omitted or `None`, gets the entire location data as `json` | |
54 | 54 |
|
55 | 55 | [1] Fields supported by the API : `ip`, `city`, `region`, `region_code`, `country`, `country_code`, `country_code_iso3`, `country_capital`, `country_tld`, `country_name`, `continent_code`, `in_eu`, `postal`, `latitude`, `longitude`, `timezone`, `utc_offset`, `country_calling_code`, `currency`, `currency_name`, `languages`, `country_area`, `country_population`, `latlong`, `asn`, `org` |
56 | 56 |
|
57 | 57 | #### Examples |
58 | 58 |
|
59 | | -1. Find the **location of your IP address** (suppose your IP is '50.1.2.3') |
| 59 | +1. Find the **location of your IP address** |
60 | 60 | ```python |
61 | 61 | >>> ipapi.location() |
62 | 62 | ``` |
63 | | -The output would be a `JSON` object like this : |
| 63 | +The output would be a `JSON` object like this (assuming your IP is '50.1.2.3') : |
64 | 64 | ```json |
65 | 65 | { |
66 | 66 | "ip": "50.1.2.3", |
@@ -150,7 +150,7 @@ You can also use an IPv6 address e.g. |
150 | 150 | ``` |
151 | 151 | 'CA' |
152 | 152 | ``` |
153 | | -8. Find if **IP address is located in European Union** |
| 153 | +8. Find if an **IP address is located in the European Union** |
154 | 154 | ```python |
155 | 155 | >>> ipapi.location(ip='8.8.8.8', output='in_eu') |
156 | 156 | ``` |
@@ -206,8 +206,9 @@ You can also use an IPv6 address e.g. |
206 | 206 |
|
207 | 207 | ```bash |
208 | 208 | $ python ipapi -i <IP Address> -k <API KEY> -o <Output Format> |
| 209 | +$ python ipapi --ip <IP Address> --key <API KEY> --output <Output Format> |
209 | 210 | ``` |
210 | | -where the options are defined above. |
| 211 | +where the [options](#options) ip, key, output are defined above. |
211 | 212 |
|
212 | 213 | #### Examples |
213 | 214 |
|
|
0 commit comments