예제 #1
0
def clientresp(data, **kwargs):
    """
    Deprecated endpoint, still used because it can parse data out of a plot.

    When we get around to forcing users to create grids and then create plots,
    we can finally get rid of this.

    :param (list) data: The data array from a figure.

    """
    creds = config.get_credentials()
    cfg = config.get_config()

    dumps_kwargs = {'sort_keys': True, 'cls': utils.PlotlyJSONEncoder}

    payload = {
        'platform': 'python', 'version': version.stable_semver(),
        'args': _json.dumps(data, **dumps_kwargs),
        'un': creds['username'], 'key': creds['api_key'], 'origin': 'plot',
        'kwargs': _json.dumps(kwargs, **dumps_kwargs)
    }

    url = '{plotly_domain}/clientresp'.format(**cfg)
    response = request('post', url, data=payload)

    # Old functionality, just keeping it around.
    parsed_content = response.json()
    if parsed_content.get('warning'):
        warnings.warn(parsed_content['warning'])
    if parsed_content.get('message'):
        print(parsed_content['message'])

    return response
예제 #2
0
    def test_request_validate_response(self):

        # Finally, we check details elsewhere, but make sure we do validate.

        utils.request(self.method, self.url)
        self.validate_response_mock.assert_called_once()
예제 #3
0
    def test_request_validate_response(self):

        # Finally, we check details elsewhere, but make sure we do validate.

        utils.request(self.method, self.url)
        assert self.validate_response_mock.call_count == 1
예제 #4
0
    def test_request_validate_response(self):

        # Finally, we check details elsewhere, but make sure we do validate.

        utils.request(self.method, self.url)
        assert self.validate_response_mock.call_count == 1
예제 #5
0
    def test_request_validate_response(self):

        # Finally, we check details elsewhere, but make sure we do validate.

        utils.request(self.method, self.url)
        self.validate_response_mock.assert_called_once()