In [1]:
import datadotworld as dw
client = dw.api_client()
In [2]:
client.help()
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-2-bdb405327d98> in <module>()
----> 1 client.help()
AttributeError: 'RestApiClient' object has no attribute 'help'
In [ ]:
client.create_dataset
In [3]:
help(client)
Help on RestApiClient in module datadotworld.client.api object:
class RestApiClient(builtins.object)
| REST API client
|
| Parameters
| ----------
| profile : str, optional
| Name of the configuration profile to use
|
| Methods defined here:
|
| __init__(self, config)
| Initialize self. See help(type(self)) for accurate signature.
|
| add_files_via_url(self, dataset_key, files={})
| Add or update dataset files linked to source URLs
|
| Parameters
| ----------
| dataset_key : str
| Dataset identifier, in the form of owner/id
| files : dict
| File names and source URLs to add or update
|
| Raises
| ------
| RestApiException
| If a server error occurs
|
| Examples
| --------
| >>> import datadotworld as dw
| >>> url = 'http://www.acme.inc/example.csv'
| >>> api_client = dw.api_client()
| >>> api_client.add_files_via_url(
| ... 'username/test-dataset',
| ... {'example.csv': url}) # doctest: +SKIP
|
| create_dataset(self, owner_id, **kwargs)
| Create a new dataset
|
| Parameters
| ----------
| owner_id : str
| Username of the owner of the new dataset
| title : str
| Dataset title (will be used to generate dataset id on creation)
| description : str, optional
| Dataset description
| summary : str, optional
| Dataset summary markdown
| tags : list, optional
| Dataset tags
| license : {'Public Domain', 'PDDL', 'CC-0', 'CC-BY', 'ODC-BY',
| 'CC-BY-SA', 'ODC-ODbL', 'CC BY-NC', 'CC BY-NC-SA', 'Other'}
| Dataset license
| visibility : {'OPEN', 'PRIVATE'}
| Dataset visibility
| files : dict, optional
| File names and source URLs
|
| Raises
| ------
| RestApiException
| If a server error occurs
|
| Examples
| --------
| >>> import datadotworld as dw
| >>> api_client = dw.api_client()
| >>> api_client.create_dataset(
| ... 'username', title='Test dataset', visibility='PRIVATE',
| ... license='Public Domain') # doctest: +SKIP
|
| delete_files(self, dataset_key, names)
| Delete dataset file(s)
|
| Parameters
| ----------
| dataset_key : str
| Dataset identifier, in the form of owner/id
| names : list of str
| The list of names for files to be deleted
|
| Raises
| ------
| RestApiException
| If a server error occurs
|
| Examples
| --------
| >>> import datadotworld as dw
| >>> api_client = dw.api_client()
| >>> api_client.delete_files(
| ... 'username/test-dataset', ['example.csv']) # doctest: +SKIP
|
| download_datapackage(self, dataset_key, dest_dir)
| Download and unzip a dataset's datapackage
|
| Parameters
| ----------
| dataset_key : str
| Dataset identifier, in the form of owner/id
| dest_dir : str or path
| Directory under which datapackage should be saved
|
| Returns
| -------
| path
| Location of the datapackage descriptor (datapackage.json) in the
| local filesystem
|
| Raises
| ------
| RestApiException
| If a server error occurs
|
| Examples
| >>> import datadotworld as dw
| >>> api_client = dw.api_client()
| >>> datapackage_descriptor = api_client.download_datapackage(
| ... 'jonloyens/an-intro-to-dataworld-dataset', '/tmp/test')
| >>> datapackage_descriptor
| '/tmp/test/datapackage.json'
|
| get_dataset(self, dataset_key)
| Retrieve an existing dataset definition
|
| This method retrieves metadata about an existing
|
| Parameters
| ----------
| dataset_key : str
| Dataset identifier, in the form of owner/id
|
| Returns
| -------
| dict
| Dataset definition, with all attributes
|
| Raises
| ------
| RestApiException
| If a server error occurs
|
| Examples
| --------
| >>> import datadotworld as dw
| >>> api_client = dw.api_client()
| >>> intro_dataset = api_client.get_dataset(
| ... 'jonloyens/an-intro-to-dataworld-dataset')
| >>> intro_dataset['title']
| 'An Intro to data.world Dataset'
|
| replace_dataset(self, dataset_key, **kwargs)
| Replace an existing dataset
|
| *This method will completely overwrite an existing dataset.*
|
| Parameters
| ----------
| description : str, optional
| Dataset description
| summary : str, optional
| Dataset summary markdown
| tags : list, optional
| Dataset tags
| license : {'Public Domain', 'PDDL', 'CC-0', 'CC-BY', 'ODC-BY',
| 'CC-BY-SA', 'ODC-ODbL', 'CC BY-NC', 'CC BY-NC-SA', 'Other'}
| Dataset license
| visibility : {'OPEN', 'PRIVATE'}
| Dataset visibility
| files : dict, optional
| File names and source URLs to add or update
|
| Raises
| ------
| RestApiException
| If a server error occurs
|
| Examples
| --------
| >>> import datadotworld as dw
| >>> api_client = dw.api_client()
| >>> api_client.replace_dataset(
| ... 'username/test-dataset',
| ... visibility='PRIVATE', license='Public Domain',
| ... description='A better description') # doctest: +SKIP
|
| sync_files(self, dataset_key)
| Trigger synchronization process to update all dataset files linked to
| source URLs.
|
| Parameters
| ----------
| dataset_key : str
| Dataset identifier, in the form of owner/id
|
| Raises
| ------
| RestApiException
| If a server error occurs
|
| Examples
| --------
| >>> import datadotworld as dw
| >>> api_client = dw.api_client()
| >>> api_client.sync_files('username/test-dataset') # doctest: +SKIP
|
| update_dataset(self, dataset_key, **kwargs)
| Update an existing dataset
|
| Parameters
| ----------
| description : str, optional
| Dataset description
| summary : str, optional
| Dataset summary markdown
| tags : list, optional
| Dataset tags
| license : {'Public Domain', 'PDDL', 'CC-0', 'CC-BY', 'ODC-BY',
| 'CC-BY-SA', 'ODC-ODbL', 'CC BY-NC', 'CC BY-NC-SA', 'Other'}
| Dataset license
| visibility : {'OPEN', 'PRIVATE'}, optional
| Dataset visibility
| files : dict, optional
| File names and source URLs to add or update
|
| Raises
| ------
| RestApiException
| If a server error occurs
|
| Examples
| --------
| >>> import datadotworld as dw
| >>> api_client = dw.api_client()
| >>> api_client.update_dataset(
| ... 'username/test-dataset',
| ... tags=['demo', 'datadotworld']) # doctest: +SKIP
|
| upload_files(self, dataset_key, files)
| Upload dataset files
|
| Parameters
| ----------
| dataset_key : str
| Dataset identifier, in the form of owner/id
| files : list of str
| The list of names/paths for files stored in the local filesystem
|
| Raises
| ------
| RestApiException
| If a server error occurs
|
| Examples
| --------
| >>> import datadotworld as dw
| >>> api_client = dw.api_client()
| >>> api_client.upload_files(
| ... 'username/test-dataset',
| ... ['/my/local/example.csv']) # doctest: +SKIP
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables (if defined)
|
| __weakref__
| list of weak references to the object (if defined)
In [ ]:
Content source: CivicKnowledge/metatab-packages
Similar notebooks: