77pip install ipapi
88```
99or
10+
1011```
1112python setup.py install
1213```
@@ -22,27 +23,27 @@ ipapi.location()
2223# Gets complete location for your IP address
2324{u'city': u'Wilton', u'ip': u'50.1.2.3', u'region': u'California', u'longitude': -121.2429, u'country': u'US', u'latitude': 38.3926, u'timezone': u'America/Los_Angeles', u'postal': u'95693'}
2425
25- ipapi.field( 'ip')
26+ ipapi.location(None, None, 'ip')
2627# Gets my external IP address
2728u'50.1.2.3'
2829
29- ipapi.field( 'city')
30+ ipapi.location(None, None, 'city')
3031# Gets your city name
3132u'Wilton'
3233
33- ipapi.field( 'country')
34+ ipapi.location(None, None, 'country')
3435# Gets your country
3536u'US'
3637
3738ipapi.location('8.8.8.8')
3839# Gets complete location for IP address 8.8.8.8
3940{u'city': u'Mountain View', u'ip': u'8.8.8.8', u'region': u'California', u'longitude': -122.0838, u'country': u'US', u'latitude': 37.386, u'timezone': u'America/Los_Angeles', u'postal': u'94035'}
4041
41- ipapi.field('city', ' 8.8.8.8')
42+ ipapi.location(' 8.8.8.8', None, 'city ')
4243# Gets city name for IP address 8.8.8.8
4344u'Mountain View'
4445
45- ipapi.field('country', ' 8.8.8.8')
46+ ipapi.location(' 8.8.8.8', None, 'country ')
4647# Gets country for IP address 8.8.8.8
4748u'US'
4849```
@@ -75,4 +76,9 @@ API key can be specified in the following ways :
7576
76771 . Inside ` ipapi.py ` by setting ` API_KEY ` variable
77782 . Via command line with the ` -k ` option
78- 3 . As a function argument e.g. ` ipapi.field(field='country', ip='8.8.8.8', key='xyz') ` or ` ipapi.location(ip='8.8.8.8', key='xyz') `
79+ 3 . As a function argument e.g. ` ipapi.location(ip='8.8.8.8', key='secret-key') ` or ` ipapi.location(ip='8.8.8.8', key='secret-key', field='city') `
80+
81+ ### Notes
82+ - All function arguments (` ip ` , ` key ` , ` field ` ) are optional . To skip an argument, use ` None ` or an empty string ` '' ` .
83+ ` ipapi.location(ip='8.8.8.8', key=None, field='city') `
84+ ` ipapi.location(ip='8.8.8.8', key='', field='city') `
0 commit comments