# Path: shippo/error.py
# class ShippoError(Exception):
# class APIError(ShippoError):
# class APIConnectionError(ShippoError):
# class AddressError(ShippoError):
# class InvalidRequestError(ShippoError):
# class AuthenticationError(ShippoError):
#     def __init__(self, message=None, http_body=None, http_status=None,
#                  json_body=None):
#     def __init__(self, message, param, code, http_body=None,
#                  http_status=None, json_body=None):
#     def __init__(self, message, param, http_body=None,
#                  http_status=None, json_body=None):
# 
# Path: shippo/http_client.py
# def new_default_http_client(*args, **kwargs):
#     def __init__(self, verify_ssl_certs=True):
#     def request(self, method, url, headers, post_data=None):
#     def request(self, method, url, headers, post_data=None):
#     def _handle_request_error(self, e):
#     def request(self, method, url, headers, post_data=None):
#     def _handle_request_error(self, e, url):
# class HTTPClient(object):
# class RequestsClient(HTTPClient):
# class UrlFetchClient(HTTPClient):
# 
# Path: shippo/util.py

# 
# Path: shippo/certificate_blacklist.py
# BLACKLISTED_DIGESTS = {
# }
# def verify(hostname, certificate):
# 
# Path: shippo/version.py
# VERSION = '2.1.2'


import calendar
import datetime
import os
import platform
import socket
import ssl
import time
import urllib.parse
import warnings
import shippo
from shippo import error, http_client, util, certificate_blacklist
from shippo.version import VERSION
        from shippo.config import verify_ssl_certs
        from shippo.config import api_version
            from shippo.config import api_key
        from shippo.config import verify_ssl_certs

    return urllib.parse.urlunsplit((scheme, netloc, path, query, fragment))


class APIRequestor(object):

    _CERTIFICATE_VERIFIED = False

    def __init__(self, key=None, client=None):
        self.api_key = key


        self._client = client or http_client.new_default_http_client(
            verify_ssl_certs=verify_ssl_certs)

    def request(self, method, url, params=None):
        self._check_ssl_cert()\

        if params is not None and isinstance(params, dict):
            params = {('async' if k == 'asynchronous' else k): v for k, v in params.items()}

        rbody, rcode, my_api_key = self.request_raw(
            method.lower(), url, params)

        resp = self.interpret_response(rbody, rcode)
        return resp, my_api_key

    def handle_api_error(self, rbody, rcode, resp):

        if rcode in [400, 404]:

# Path: shippo/error.py
# class ShippoError(Exception):
# class APIError(ShippoError):
# class APIConnectionError(ShippoError):
# class AddressError(ShippoError):
# class InvalidRequestError(ShippoError):
# class AuthenticationError(ShippoError):
#     def __init__(self, message=None, http_body=None, http_status=None,
#                  json_body=None):
#     def __init__(self, message, param, code, http_body=None,
#                  http_status=None, json_body=None):
#     def __init__(self, message, param, http_body=None,
#                  http_status=None, json_body=None):
# 
# Path: shippo/http_client.py
# def new_default_http_client(*args, **kwargs):
#     def __init__(self, verify_ssl_certs=True):
#     def request(self, method, url, headers, post_data=None):
#     def request(self, method, url, headers, post_data=None):
#     def _handle_request_error(self, e):
#     def request(self, method, url, headers, post_data=None):
#     def _handle_request_error(self, e, url):
# class HTTPClient(object):
# class RequestsClient(HTTPClient):
# class UrlFetchClient(HTTPClient):
# 
# Path: shippo/util.py

# 
# Path: shippo/certificate_blacklist.py
# BLACKLISTED_DIGESTS = {
# }
# def verify(hostname, certificate):
# 
# Path: shippo/version.py
# VERSION = '2.1.2'


# Path: shippo/api_requestor.py
import calendar
import datetime
import os
import platform
import socket
import ssl
import time
import urllib.parse
import warnings
import shippo
from shippo import error, http_client, util, certificate_blacklist
from shippo.version import VERSION
        from shippo.config import verify_ssl_certs
        from shippo.config import api_version
            from shippo.config import api_key
        from shippo.config import verify_ssl_certs


    return urllib.parse.urlunsplit((scheme, netloc, path, query, fragment))


class APIRequestor(object):

    _CERTIFICATE_VERIFIED = False

    def __init__(self, key=None, client=None):
        self.api_key = key


        self._client = client or http_client.new_default_http_client(
            verify_ssl_certs=verify_ssl_certs)

    def request(self, method, url, params=None):
        self._check_ssl_cert()\

        if params is not None and isinstance(params, dict):
            params = {('async' if k == 'asynchronous' else k): v for k, v in params.items()}

        rbody, rcode, my_api_key = self.request_raw(
            method.lower(), url, params)

        resp = self.interpret_response(rbody, rcode)
        return resp, my_api_key

    def handle_api_error(self, rbody, rcode, resp):

        if rcode in [400, 404]:

            raise error.InvalidRequestError(rbody, rcode, resp)