How to use the quandl.util.Util.constructed_path function in Quandl

To help you get started, we’ve selected a few Quandl examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github quandl / quandl-python / test / test_util.py View on Github external
def test_constructed_path(self):
        path = '/hello/:foo/world/:id'
        params = {'foo': 'bar', 'id': 1, 'another': 'a'}
        result = Util.constructed_path(path, params)
        self.assertEqual(result, '/hello/bar/world/1')
        self.assertDictEqual(params, {'another': 'a'})
github quandl / quandl-python / quandl / model / database.py View on Github external
def _bulk_download_path(self):
        url = self.default_path() + '/data'
        url = Util.constructed_path(url, {'id': self.code})
        return url
github quandl / quandl-python / quandl / operations / list.py View on Github external
def all(cls, **options):
        if 'params' not in options:
            options['params'] = {}
        path = Util.constructed_path(cls.list_path(), options['params'])
        r = Connection.request('get', path, **options)
        response_data = r.json()
        Util.convert_to_dates(response_data)
        resource = cls.create_list_from_response(response_data)
        return resource
github quandl / quandl-python / quandl / operations / list.py View on Github external
def page(cls, datatable, **options):
        params = {'id': str(datatable.code)}
        path = Util.constructed_path(datatable.default_path(), params)

        request_type = RequestType.get_request_type(path, **options)

        updated_options = Util.convert_options(request_type=request_type, **options)

        r = Connection.request(request_type, path, **updated_options)

        response_data = r.json()
        Util.convert_to_dates(response_data)
        resource = cls.create_datatable_list_from_response(response_data)
        return resource
github quandl / quandl-python / quandl / model / datatable.py View on Github external
def _download_request_path(self):
        url = self.default_path()
        url = Util.constructed_path(url, {'id': self.code})
        url += '.json'
        return url