def _build_request(self, path, params=None):
        """Build API request"""

        _url = '{scheme}://{host}{port}/{version}{path}'.format(
            scheme=self._scheme,
            host=self._host,
            port=':{}'.format(self._port) if self._port != 80 else '',
            version=self._api_version,
            path=path)

        if params is not None:
            _params = params.copy()
        else:
            _params = dict()

        # Add required API parameters
        _params['api_nonce'] = str(random.randint(0, 999999999)).zfill(9)
        _params['api_timestamp'] = int(time.time())
        _params['api_key'] = self.__key
        _params['api_format'] = 'json'
        _params['api_kit'] = 'py-{}{}'.format(
            __version__, '-{}'.format(self._agent) if self._agent else '')

        # Construct Signature Base String
        sbs = '&'.join(['{}={}'.format(
            quote((unicode(key).encode('utf-8')), safe='~'),
            quote((unicode(value).encode('utf-8')), safe='~')
        ) for key, value in sorted(_params.items())])

        # Add signature to the _params dict
        _params['api_signature'] = hashlib.sha1(
            '{}{}'.format(sbs, self.__secret).encode('utf-8')).hexdigest()

        return _url, _params
Build API request