-
Notifications
You must be signed in to change notification settings - Fork 282
/
utils.py
53 lines (48 loc) · 1.47 KB
/
utils.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/usr/bin/python
# coding: utf8
import api
from keys import *
from geocoder import Geocoder
from ip import Ip
from osm import Osm
from bing import Bing
from nokia import Nokia
from arcgis import Arcgis
from tomtom import Tomtom
from google import Google
from reverse import Reverse
from geonames import Geonames
from mapquest import Mapquest
from timezone import Timezone
from elevation import Elevation
from geolytica import Geolytica
def get_provider(location, provider, short_name):
provider = provider.lower()
if provider == 'google':
return Google(location)
elif provider == 'bing':
return Bing(location, key=bing_key)
elif provider == 'osm':
return Osm(location)
elif provider == 'nokia':
return Nokia(location, app_id=app_id, app_code=app_code)
elif provider == 'mapquest':
return Mapquest(location)
elif provider == 'arcgis':
return Arcgis(location)
elif provider == 'ip':
return Ip(location)
elif provider == 'reverse':
return Reverse(location)
elif provider == 'tomtom':
return Tomtom(location, key=tomtom_key)
elif provider == 'geonames':
return Geonames(location, username=username)
elif provider == 'geolytica':
return Geolytica(location)
elif provider == 'elevation':
return Elevation(location)
elif provider == 'timezone':
return Timezone(location)
if __name__ == "__main__":
print get_provider("Ottawa", provider='google')