Add method to parse URL into piece parts
[testsuite/python-testing-utils.git] / eteutils / HTTPUtils.py
1 import urllib
2 from requests.packages import urllib3
3 from urlparse import urlparse
4
5 class HTTPUtils:
6     """HTTPUtils is common resource for simple http helper keywords."""
7
8     def url_encode_string(self, barestring):
9         """URL Encode String takes in a string and converts into 'percent-encoded' string"""
10         return urllib.quote_plus(barestring)
11
12     def disable_warnings(self):
13         """  Disable the cert warnings when creating sessions for A&AI API Calls """
14         urllib3.disable_warnings()
15
16     def url_parse(self, url):
17         """  Get pieces of the URL """
18         return urlparse(url)