# Path: xpaw/utils.py
# def get_encoding_from_content(content):
#     if isinstance(content, bytes):
#         content = content.decode("ascii", errors="ignore")
#     elif not isinstance(content, str):
#         raise ValueError("content should be bytes or str")
#     s = _charset_flag.search(content)
#     if s:
#         return s.group(1).strip()
#     s = _pragma_flag.search(content)
#     if s:
#         return s.group(1).strip()
#     s = _xml_flag.search(content)
#     if s:
#         return s.group(1).strip()
# 
# def get_encoding_from_content_type(content_type):
#     if content_type:
#         content_type, params = cgi.parse_header(content_type)
#         if "charset" in params:
#             return params["charset"]
# 
# def make_url(url, params=None):
#     args = []
#     if isinstance(params, dict):
#         for k, v in params.items():
#             if isinstance(v, (tuple, list)):
#                 for i in v:
#                     args.append((k, i))
#             else:
#                 args.append((k, v))
#     elif isinstance(params, (tuple, list)):
#         for k, v in params:
#             args.append((k, v))
#     return url_concat(url, args)


import inspect
from tornado.httputil import HTTPHeaders as _HttpHeaders
from .utils import get_encoding_from_content, get_encoding_from_content_type, make_url
# coding=utf-8




HttpHeaders = _HttpHeaders


class HttpRequest:
    def __init__(self, url, method="GET", body=None, params=None, headers=None, proxy=None,

# Path: xpaw/utils.py
# def get_encoding_from_content(content):
#     if isinstance(content, bytes):
#         content = content.decode("ascii", errors="ignore")
#     elif not isinstance(content, str):
#         raise ValueError("content should be bytes or str")
#     s = _charset_flag.search(content)
#     if s:
#         return s.group(1).strip()
#     s = _pragma_flag.search(content)
#     if s:
#         return s.group(1).strip()
#     s = _xml_flag.search(content)
#     if s:
#         return s.group(1).strip()
# 
# def get_encoding_from_content_type(content_type):
#     if content_type:
#         content_type, params = cgi.parse_header(content_type)
#         if "charset" in params:
#             return params["charset"]
# 
# def make_url(url, params=None):
#     args = []
#     if isinstance(params, dict):
#         for k, v in params.items():
#             if isinstance(v, (tuple, list)):
#                 for i in v:
#                     args.append((k, i))
#             else:
#                 args.append((k, v))
#     elif isinstance(params, (tuple, list)):
#         for k, v in params:
#             args.append((k, v))
#     return url_concat(url, args)


# Path: xpaw/http.py
import inspect
from tornado.httputil import HTTPHeaders as _HttpHeaders
from .utils import get_encoding_from_content, get_encoding_from_content_type, make_url

# coding=utf-8




HttpHeaders = _HttpHeaders


class HttpRequest:
    def __init__(self, url, method="GET", body=None, params=None, headers=None, proxy=None,

                 timeout=20, verify_ssl=False, allow_redirects=True, auth=None, proxy_auth=None,