How to use the routingpy.utils.get_ordinal function in routingpy

To help you get started, we’ve selected a few routingpy examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github gis-ops / routing-py / tests / test_utils.py View on Github external
def test_get_ordinal(self):

        self.assertEqual(utils.get_ordinal(0), 'th')
        self.assertEqual(utils.get_ordinal(1), 'st')
        self.assertEqual(utils.get_ordinal(2), 'nd')
        self.assertEqual(utils.get_ordinal(3), 'rd')
github gis-ops / routing-py / tests / test_utils.py View on Github external
def test_get_ordinal(self):

        self.assertEqual(utils.get_ordinal(0), 'th')
        self.assertEqual(utils.get_ordinal(1), 'st')
        self.assertEqual(utils.get_ordinal(2), 'nd')
        self.assertEqual(utils.get_ordinal(3), 'rd')
github gis-ops / routing-py / tests / test_utils.py View on Github external
def test_get_ordinal(self):

        self.assertEqual(utils.get_ordinal(0), 'th')
        self.assertEqual(utils.get_ordinal(1), 'st')
        self.assertEqual(utils.get_ordinal(2), 'nd')
        self.assertEqual(utils.get_ordinal(3), 'rd')
github gis-ops / routing-py / tests / test_utils.py View on Github external
def test_get_ordinal(self):

        self.assertEqual(utils.get_ordinal(0), 'th')
        self.assertEqual(utils.get_ordinal(1), 'st')
        self.assertEqual(utils.get_ordinal(2), 'nd')
        self.assertEqual(utils.get_ordinal(3), 'rd')
github gis-ops / routing-py / routingpy / routers / base.py View on Github external
except exceptions.RouterApiError:
            if self.skip_api_error:
                warnings.warn(
                    "Router {} returned an API error with "
                    "the following message:\n{}".format(self.__class__.__name__, response.text)
                )
                return

            raise

        except exceptions.RetriableRequest as e:
            if isinstance(e, exceptions.OverQueryLimit) and not self.retry_over_query_limit:
                raise

            warnings.warn(
                'Rate limit exceeded.\nRetrying for the {}{} time.'.format(tried, get_ordinal(tried)),
                UserWarning
            )
            # Retry request.
            return self._request(
                url, get_params, post_params, first_request_time, retry_counter + 1, requests_kwargs
            )
github gis-ops / routing-py / routingpy / routers / base.py View on Github external
)
            return

        try:
            response = requests_method(self.base_url + authed_url, **final_requests_kwargs)
            self._req = response.request

        except requests.exceptions.Timeout:
            raise exceptions.Timeout()

        tried = retry_counter + 1

        if response.status_code in _RETRIABLE_STATUSES:
            # Retry request.
            warnings.warn(
                'Server down.\nRetrying for the {}{} time.'.format(tried, get_ordinal(tried)),
                UserWarning
            )

            return self._request(
                url, get_params, post_params, first_request_time, retry_counter + 1, requests_kwargs
            )

        try:
            result = self._get_body(response)

            return result

        except exceptions.RouterApiError:
            if self.skip_api_error:
                warnings.warn(
                    "Router {} returned an API error with "