summaryrefslogtreecommitdiffstats
path: root/eteutils/HTTPUtils.py
blob: 9324af7d7d7db7d7faa6b0a87719dd58047bb674 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import urllib
import urllib3
import urlparse

class HTTPUtils:
    """HTTPUtils is common resource for simple http helper keywords."""

    def url_encode_string(self, barestring):
        """URL Encode String takes in a string and converts into 'percent-encoded' string"""
        return urllib.quote_plus(barestring)

    def disable_warnings(self):
        """  Disable the cert warnings when creating sessions for A&AI API Calls """
        urllib3.disable_warnings()

    def url_parse(self, url):
        """  Get pieces of the URL """
        return urlparse.urlparse(url)