# Path: solvebio/version.py
# VERSION = '2.18.1'
# 
# Path: solvebio/errors.py
# class SolveError(Exception):
#     """Exceptions tailored to the kinds of errors from a SolveBio API
#     request"""
#     default_message = ('Unexpected error communicating with SolveBio. '
#                        'If this problem persists, let us know at '
#                        'support@solvebio.com.')
# 
#     def __init__(self, message=None, response=None):
#         self.json_body = {}
#         self.status_code = None
#         self.message = message or self.default_message
#         self.field_errors = []
#         self.response = response
# 
#         if response is not None:
#             self.status_code = response.status_code
#             try:
#                 self.json_body = response.json()
#                 logger.debug(
#                     'API Response (%d): %s'
#                     % (self.status_code, self.json_body))
#             except:
#                 logger.debug(
#                     'API Response (%d): Response does not contain JSON.'
#                     % self.status_code)
# 
#             if self.status_code == 400:
#                 self.message = 'Bad Request ({})'.format(response.url)
#             elif response.status_code == 401:
#                 self.message = '401 Unauthorized ({})'.format(response.url)
#             elif response.status_code == 403:
#                 self.message = '403 Forbidden ({})'.format(response.url)
#             elif response.status_code == 404:
#                 self.message = '404 Not Found ({})'.format(response.url)
# 
#             # Handle other keys
#             for k, v in list(self.json_body.items()):
#                 if k in ["non_field_errors", "detail"]:
#                     self.message += '\nError: '
#                 else:
#                     self.message += '\nError (%s): ' % k
# 
#                 # can be a list, dict, string
#                 self.message += str(v)
# 
#     def __str__(self):
#         return self.message
# 
# Path: solvebio/utils/validators.py
# def validate_api_host_url(url):
#     """
#     Validate SolveBio API host url.
# 
#     Valid urls must not be empty and
#     must contain either HTTP or HTTPS scheme.
#     """
#     if not url:
#         raise SolveError('No SolveBio API host is set')
# 
#     # Default to https if no scheme is set
#     if '://' not in url:
#         url = 'https://' + url
# 
#     parsed = urlparse(url)
#     if parsed.scheme not in ['http', 'https']:
#         raise SolveError(
#             'Invalid API host: %s. '
#             'Missing url scheme (HTTP or HTTPS).' % url
#         )
#     elif not parsed.netloc:
#         raise SolveError('Invalid API host: %s.' % url)
# 
#     return parsed.geturl()


import json
import time
import inspect
import solvebio
import platform
import requests
import textwrap
import logging
    import urllib3.contrib.pyopenssl
from .version import VERSION
from .errors import SolveError
from .utils.validators import validate_api_host_url
from requests import Session
from requests import codes
from requests.auth import AuthBase
from requests.adapters import HTTPAdapter
from requests.packages.urllib3.util.retry import Retry
from six.moves.urllib.parse import urljoin
        from requests import Request, Session
# -*- coding: utf-8 -*-
from __future__ import absolute_import







# Try using pyopenssl if available.
# Requires: pip install pyopenssl ndg-httpsclient pyasn1
# See http://urllib3.readthedocs.org/en/latest/contrib.html#module-urllib3.contrib.pyopenssl  # noqa
try:
    urllib3.contrib.pyopenssl.inject_into_urllib3()
except ImportError:
    pass

logger = logging.getLogger('solvebio')


def _handle_api_error(response):
    if response.status_code not in [400, 401, 403, 404]:
        logger.info('API Error: %d' % response.status_code)
    raise SolveError(response=response)


def _handle_request_error(e):
    if isinstance(e, requests.exceptions.RequestException):

# Path: solvebio/version.py
# VERSION = '2.18.1'
# 
# Path: solvebio/errors.py
# class SolveError(Exception):
#     """Exceptions tailored to the kinds of errors from a SolveBio API
#     request"""
#     default_message = ('Unexpected error communicating with SolveBio. '
#                        'If this problem persists, let us know at '
#                        'support@solvebio.com.')
# 
#     def __init__(self, message=None, response=None):
#         self.json_body = {}
#         self.status_code = None
#         self.message = message or self.default_message
#         self.field_errors = []
#         self.response = response
# 
#         if response is not None:
#             self.status_code = response.status_code
#             try:
#                 self.json_body = response.json()
#                 logger.debug(
#                     'API Response (%d): %s'
#                     % (self.status_code, self.json_body))
#             except:
#                 logger.debug(
#                     'API Response (%d): Response does not contain JSON.'
#                     % self.status_code)
# 
#             if self.status_code == 400:
#                 self.message = 'Bad Request ({})'.format(response.url)
#             elif response.status_code == 401:
#                 self.message = '401 Unauthorized ({})'.format(response.url)
#             elif response.status_code == 403:
#                 self.message = '403 Forbidden ({})'.format(response.url)
#             elif response.status_code == 404:
#                 self.message = '404 Not Found ({})'.format(response.url)
# 
#             # Handle other keys
#             for k, v in list(self.json_body.items()):
#                 if k in ["non_field_errors", "detail"]:
#                     self.message += '\nError: '
#                 else:
#                     self.message += '\nError (%s): ' % k
# 
#                 # can be a list, dict, string
#                 self.message += str(v)
# 
#     def __str__(self):
#         return self.message
# 
# Path: solvebio/utils/validators.py
# def validate_api_host_url(url):
#     """
#     Validate SolveBio API host url.
# 
#     Valid urls must not be empty and
#     must contain either HTTP or HTTPS scheme.
#     """
#     if not url:
#         raise SolveError('No SolveBio API host is set')
# 
#     # Default to https if no scheme is set
#     if '://' not in url:
#         url = 'https://' + url
# 
#     parsed = urlparse(url)
#     if parsed.scheme not in ['http', 'https']:
#         raise SolveError(
#             'Invalid API host: %s. '
#             'Missing url scheme (HTTP or HTTPS).' % url
#         )
#     elif not parsed.netloc:
#         raise SolveError('Invalid API host: %s.' % url)
# 
#     return parsed.geturl()


# Path: solvebio/client.py
import json
import time
import inspect
import solvebio
import platform
import requests
import textwrap
import logging
    import urllib3.contrib.pyopenssl
from .version import VERSION
from .errors import SolveError
from .utils.validators import validate_api_host_url
from requests import Session
from requests import codes
from requests.auth import AuthBase
from requests.adapters import HTTPAdapter
from requests.packages.urllib3.util.retry import Retry
from six.moves.urllib.parse import urljoin
        from requests import Request, Session

# -*- coding: utf-8 -*-
from __future__ import absolute_import







# Try using pyopenssl if available.
# Requires: pip install pyopenssl ndg-httpsclient pyasn1
# See http://urllib3.readthedocs.org/en/latest/contrib.html#module-urllib3.contrib.pyopenssl  # noqa
try:
    urllib3.contrib.pyopenssl.inject_into_urllib3()
except ImportError:
    pass

logger = logging.getLogger('solvebio')


def _handle_api_error(response):
    if response.status_code not in [400, 401, 403, 404]:
        logger.info('API Error: %d' % response.status_code)
    raise SolveError(response=response)


def _handle_request_error(e):
    if isinstance(e, requests.exceptions.RequestException):

        msg = SolveError.default_message