File tree Expand file tree Collapse file tree 5 files changed +12
-8
lines changed Expand file tree Collapse file tree 5 files changed +12
-8
lines changed Original file line number Diff line number Diff line change @@ -372,7 +372,7 @@ def ip(location, **kwargs):
372
372
:param location: (optional) if left blank will return your
373
373
current IP address's location.
374
374
"""
375
- return get (location , provider = 'maxmind ' , ** kwargs )
375
+ return get (location , provider = 'ipinfo ' , ** kwargs )
376
376
377
377
378
378
def canadapost (location , ** kwargs ):
Original file line number Diff line number Diff line change @@ -284,7 +284,8 @@ def osm(self):
284
284
if self .postal :
285
285
osm ['addr:postal' ] = self .postal
286
286
if hasattr (self , 'population' ):
287
- osm ['population' ] = self .population
287
+ if self .population :
288
+ osm ['population' ] = self .population
288
289
return osm
289
290
290
291
@property
Original file line number Diff line number Diff line change @@ -157,5 +157,5 @@ def unit(self):
157
157
return self .parse .get ('SubBuilding' )
158
158
159
159
if __name__ == '__main__' :
160
- g = Canadapost ("4 2023 4th Ave W, Vancouver " )
160
+ g = Canadapost ("453 Booth Street, ON " )
161
161
g .debug ()
Original file line number Diff line number Diff line change @@ -21,8 +21,11 @@ class Maxmind(Base):
21
21
provider = 'maxmind'
22
22
method = 'geocode'
23
23
24
- def __init__ (self , location = 'me' , ** kwargs ):
25
- self .location = location
24
+ def __init__ (self , location , ** kwargs ):
25
+ if location :
26
+ self .location = location
27
+ else :
28
+ self .location = 'me'
26
29
self .headers = {
27
30
'Referer' : 'https://www.maxmind.com/en/geoip_demo' ,
28
31
'Host' : 'www.maxmind.com' ,
@@ -110,5 +113,5 @@ def metro_code(self):
110
113
return self .parse ['location' ].get ('metro_code' )
111
114
112
115
if __name__ == '__main__' :
113
- g = Maxmind ('me ' )
116
+ g = Maxmind ('8.8.8.8 ' )
114
117
g .debug ()
Original file line number Diff line number Diff line change @@ -323,5 +323,5 @@ def place_rank(self):
323
323
324
324
325
325
if __name__ == '__main__' :
326
- g = Osm ('1552 Payette dr, Ottawa ON ' )
327
- g . debug ( )
326
+ g = Osm ('New York City ' )
327
+ print ( g . osm )
You can’t perform that action at this time.
0 commit comments