本文整理汇总了Python中programy.utils.text.text.TextUtils.urlify方法的典型用法代码示例。如果您正苦于以下问题:Python TextUtils.urlify方法的具体用法?Python TextUtils.urlify怎么用?Python TextUtils.urlify使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类programy.utils.text.text.TextUtils
的用法示例。
在下文中一共展示了TextUtils.urlify方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _get_directions_between_addresses_response
# 需要导入模块: from programy.utils.text.text import TextUtils [as 别名]
# 或者: from programy.utils.text.text.TextUtils import urlify [as 别名]
def _get_directions_between_addresses_response(self, origin, destination, country, mode, units):
origin = TextUtils.urlify(origin)
destination = TextUtils.urlify(destination)
url = GoogleMaps.DIRECTIONS.format(origin, destination, country, mode, units)
return self._get_response_as_json(url)
示例2: _get_latlong_for_location_response
# 需要导入模块: from programy.utils.text.text import TextUtils [as 别名]
# 或者: from programy.utils.text.text.TextUtils import urlify [as 别名]
def _get_latlong_for_location_response(self, location):
location = TextUtils.urlify(location)
url = GoogleMaps.GEOCODE.format(location)
return self._get_response_as_json(url)
示例3: _get_distance_between_addresses
# 需要导入模块: from programy.utils.text.text import TextUtils [as 别名]
# 或者: from programy.utils.text.text.TextUtils import urlify [as 别名]
def _get_distance_between_addresses(self, origin, destination, country, mode, units):
origin = TextUtils.urlify(origin)
destination = TextUtils.urlify(destination)
url = GoogleMaps.DISTANCE.format(origin, destination, country, mode, units)
return self._get_response_as_json(url)
示例4: test_urlify
# 需要导入模块: from programy.utils.text.text import TextUtils [as 别名]
# 或者: from programy.utils.text.text.TextUtils import urlify [as 别名]
def test_urlify(self):
self.assertEquals("", TextUtils.urlify(""))
self.assertEquals("%20", TextUtils.urlify(" "))
self.assertEquals("Hello%20World", TextUtils.urlify("Hello World"))