blob: c24ebf42a0cb2d5f4615106a663968b299632ead [file] [log] [blame]
DR695Hae6fedd2019-05-01 18:52:33 -04001from six.moves.urllib.parse import urlparse
DR695H8ad85422019-05-03 11:41:14 -04002from six.moves import urllib
DR695Hae6fedd2019-05-01 18:52:33 -04003
DR695H861eba52018-02-23 16:42:59 -05004import urllib3
DR695Hae6fedd2019-05-01 18:52:33 -04005
DR695H5fa01462017-02-15 18:21:12 -05006
7class HTTPUtils:
8 """HTTPUtils is common resource for simple http helper keywords."""
Jerry Flood96e3d062017-04-21 16:32:33 -04009
DR695H5fa01462017-02-15 18:21:12 -050010 def url_encode_string(self, barestring):
11 """URL Encode String takes in a string and converts into 'percent-encoded' string"""
DR695H8ad85422019-05-03 11:41:14 -040012 return urllib.parse.quote_plus(barestring)
Jerry Flood96e3d062017-04-21 16:32:33 -040013
14 def disable_warnings(self):
15 """ Disable the cert warnings when creating sessions for A&AI API Calls """
Jerry Flood9e090202017-10-27 08:29:25 -040016 urllib3.disable_warnings()
17
18 def url_parse(self, url):
DR695H861eba52018-02-23 16:42:59 -050019 """ Get pieces of the URL """
DR695H8ad85422019-05-03 11:41:14 -040020 return urlparse(url)