Revision 564 org.gvsig.scripting/trunk/org.gvsig.scripting/org.gvsig.scripting.app/org.gvsig.scripting.app.mainplugin/src/main/resources-plugin/scripting/lib/geopy/geocoders/placefinder.py

View differences:

placefinder.py
2 2
:class:`.YahooPlaceFinder` geocoder.
3 3
"""
4 4

  
5
from functools import partial
6

  
5 7
try:
6
    from requests import get
8
    from requests import get, Request
7 9
    from requests_oauthlib import OAuth1
8 10
    requests_missing = False
9 11
except ImportError:
......
29 31
            consumer_key,
30 32
            consumer_secret,
31 33
            timeout=DEFAULT_TIMEOUT,
32
            proxies=None
34
            proxies=None,
35
            user_agent=None,
33 36
        ):  # pylint: disable=R0913
34 37
        """
35 38
        :param string consumer_key: Key provided by Yahoo.
......
54 57
                ' Install with `pip install geopy -e ".[placefinder]"`.'
55 58
            )
56 59
        super(YahooPlaceFinder, self).__init__(
57
            timeout=timeout, proxies=proxies
60
            timeout=timeout, proxies=proxies, user_agent=user_agent
58 61
        )
59 62
        self.consumer_key = (
60 63
            unicode(consumer_key)
......
138 141
            min_quality=0,
139 142
            reverse=False,
140 143
            valid_country_codes=None,
144
            with_timezone=False,
141 145
        ):  # pylint: disable=W0221,R0913
142 146
        """
143 147
        Geocode a location query.
......
153 157

  
154 158
        :param valid_country_codes:
155 159
        :type valid_country_codes: list or tuple
160

  
161
        :param bool with_timezone: Include the timezone in the response's
162
            `raw` dictionary (as `timezone`).
156 163
        """
157 164
        params = {
158 165
            "location": query,
......
163 170
            params["gflags"] = "R"
164 171
        if exactly_one is True:
165 172
            params["count"] = "1"
173
        if with_timezone is True:
174
            params['flags'] += 'T' #Return timezone
166 175

  
167 176
        response = self._call_geocoder(
168 177
            self.api,

Also available in: Unified diff