def restRequest(url):
    printDebugMessage(u'restRequest', u'Begin', 11)
    printDebugMessage(u'restRequest', (u'url: ' + url), 11)
    try:
        user_agent = getUserAgent()
        http_headers = {u'User-Agent': user_agent}
        req = Request(url, None, http_headers)
        reqH = urlopen(req)
        resp = reqH.read()
        contenttype = reqH.info()
        if ((len(resp) > 0) and (contenttype != u'image/png;charset=UTF-8') and (contenttype != u'image/jpeg;charset=UTF-8') and (contenttype != u'application/gzip;charset=UTF-8')):
            try:
                result = unicode(resp, u'utf-8')
            except UnicodeDecodeError:
                result = resp
        else:
            result = resp
        reqH.close()
    except HTTPError as ex:
        result = requests.get(url).content
    printDebugMessage(u'restRequest', u'End', 11)
    return result
def restRequest(url):
    printDebugMessage(u'restRequest', u'Begin', 11)
    printDebugMessage(u'restRequest', (u'url: ' + url), 11)
    try:
        user_agent = getUserAgent()
        http_headers = {u'User-Agent': user_agent}
        req = Request(url, None, http_headers)
        reqH = urlopen(req)
        resp = reqH.read()
        contenttype = reqH.info()
        if ((len(resp) > 0) and (contenttype != u'image/png;charset=UTF-8') and (contenttype != u'image/jpeg;charset=UTF-8') and (contenttype != u'application/gzip;charset=UTF-8')):
            try:
                result = unicode(resp, u'utf-8')
            except UnicodeDecodeError:
                result = resp
        else:
            result = resp
        reqH.close()
    except HTTPError as ex:
        result = requests.get(url).content
    printDebugMessage(u'restRequest', u'End', 11)
    return result