Packaged at last...
[pyrungps.git] / pyrungps / pygeocode.py
1 # coding=UTF-8
2 """
3 nominatim.openstreetmap.org API
4 """
5
6 import urllib3
7
8 def GetDescr(lat,lon):
9
10     reqstr = "http://maps.rvb.name/geocode.php?lat=%s&lon=%s" %(lat,lon)
11     headers = { 'User-Agent' : 'PyRunGPS/1.0', 'Referer' : 'https://maps.rvb.name' }    
12     http_pool = urllib3.connection_from_url(reqstr, headers=headers)
13     req = http_pool.urlopen('GET',reqstr)
14     return req.data.decode('utf-8','ignore')
15
16 class GeoName:
17
18     def __init__(self, lat, lon):
19
20         self.printable = GetDescr(lat,lon)
21