load_file_to_ckan

Upload a file to the CKAN datastore with your private user key, which can be found on the user profile page.

Use an ENV variable to store your api key:

export CKAN_API_KEY=********-****-****-****-************

Example command line:

load_file_to_ckan https://api.data.amsterdam.nl/catalogus afvalcontainers /data/afvalcontainers.geojson

usage: load_file_to_ckan [-h] url dataset_name file_path

Positional Arguments

url

url of the catalog:

https://api.data.amsterdam.nl/catalogus
dataset_name

name of the dataset, which can be found on the ckan page url:

https://api.data.amsterdam.nl/catalogus/dataset/afvalcontainers
file_path

location of the file including filename:

/path/to/file/to/upload.csv

functions

datapunt_processing.load.load_file_to_ckan.parser()

Parser function to run arguments from commandline and to add description to sphinx docs. To see possible styling options: https://pythonhosted.org/an_example_pypi_project/sphinx.html

datapunt_processing.load.load_file_to_ckan.upload_file_to_ckan(url, dataset_name, file_path)

Upload a file to the CKAN datastore.

Args:
  1. url: url of the catalog:

    https://api.data.amsterdam.nl/catalogus
    
  2. dataset_name: name of the dataset, which can be found on the ckan page url:

    https://api.data.amsterdam.nl/catalogus/dataset/afvalcontainers
    
  3. api_key: your private user key, which can be found on the user profile page.

  4. file_path: location of the file including filename:

    /path/to/file/to/upload.csv
    
Returns:
An uploaded file to the CKAN datastore.