Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions documentation/explanation/facades.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@ The easiest way to get started is to use the facades and configuration defaults.
facades set up both logging and HDX configuration.

The default configuration loads an internal HDX configuration located within the
library, and assumes that there is an API key file called **.hdxkey** in the current
user's home directory **\~** and a YAML project configuration located relative to your
working directory at **config/project_configuration.yaml** which you must create. The
project configuration is used for any configuration specific to your project.
library, and reads the API token from the **HDX_KEY** environment variable or from
**.hdx_configuration.yaml** in the current user's home directory **\~** (see
[Provide your API Token](../how-to/api-token.md)). It also assumes a YAML project
configuration located relative to your working directory at
**config/project_configuration.yaml** which you must create. The project configuration
is used for any configuration specific to your project.

The default logging configuration reads a configuration file internal to the library
that sets up an coloured console handler outputting at INFO level and a file handler
Expand Down
3 changes: 3 additions & 0 deletions documentation/explanation/information.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,8 @@ This library is part of the [Humanitarian Data Exchange](https://data.humdata.or
(HDX) project. If you have humanitarian related data, please upload your datasets to
HDX.

For an overview of HDX concepts such as organizations, datasets and resources, see
[HDX core concepts](https://docs.humdata.org/build/overview/hdx-core-concepts).

The code for the library is [here](https://github.com/OCHA-DAP/hdx-python-api).
The library has detailed API documentation which can be found in the menu at the top.
24 changes: 0 additions & 24 deletions documentation/how-to/api-key.md

This file was deleted.

14 changes: 14 additions & 0 deletions documentation/how-to/api-token.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Provide your API Token

Reading data from HDX does not need a token. Writing data does. To create one, follow
the instructions in
[HDX core concepts](https://docs.humdata.org/build/overview/hdx-core-concepts).

Supply the token to the library (called `hdx_key`) in one of these ways:

1. Pass it as a parameter or within a dictionary
2. Set the `HDX_KEY` environment variable
3. Put it in a JSON or YAML file. The default path is **.hdx_configuration.yaml** in
the current user's home directory **\~**. Then put in the YAML file:

hdx_key: "HDX API TOKEN"
3 changes: 3 additions & 0 deletions documentation/how-to/objects.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Use HDX Objects

HDX data is organised as organizations, datasets and resources. For more about these
concepts, see [HDX core concepts](https://docs.humdata.org/build/overview/hdx-core-concepts).

You can read an existing HDX object with the static **read_from_hdx** method
which takes an identifier parameter and returns the an object of the appropriate HDX
object type eg. **Dataset** or **None** depending upon whether the object was read eg.
Expand Down
2 changes: 1 addition & 1 deletion documentation/how-to/operate-resources/datastore.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ A resource's data can be loaded into the HDX datastore and queried. HDX calls th
[Tabular Data Endpoints (TDE)](https://docs.humdata.org/build/hdx-apis/tabular-data-endpoints),
and it is available only for resources with TDE enabled (their `datastore_active`
field is true). Contact hdx@un.org to request TDE for your datasets. HDX requires an
API key for all datastore actions and dumps, including reads of public resources,
API token for all datastore actions and dumps, including reads of public resources,
and limits each IP address to 60 requests per minute. To create, update or delete
the datastore for a resource:

Expand Down
2 changes: 1 addition & 1 deletion documentation/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ upload your datasets to HDX.
## How-to Guides

- Set up
- [Obtain your API Key](how-to/api-key.md)
- [Provide your API Token](how-to/api-token.md)
- [Install the Library](how-to/install.md)
- [Build a Docker image](how-to/docker.md)
- [Build a project Framework](how-to/framework.md)
Expand Down
2 changes: 1 addition & 1 deletion documentation/mkdocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ nav:
- A Quick Example: tutorials/getting-started.md
- How-to Guides:
- Set up:
- Obtain your API Key: how-to/api-key.md
- Provide your API Token: how-to/api-token.md
- Install the Library: how-to/install.md
- Build a Docker image: how-to/docker.md
- Build a project Framework: how-to/framework.md
Expand Down
12 changes: 6 additions & 6 deletions documentation/tutorials/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ Let's start with a simple example that also ensures that the library is working
properly. In this tutorial, we use virtualenv, a sandbox, so that your Python install is
not modified.

1. If you just want to read data from HDX, then an API key is not necessary. However,
1. If you just want to read data from HDX, then an API token is not necessary. However,
if you want to write data to HDX, then you need to register on the website to obtain an
API key. Please see [Obtain your API Key](../how-to/api-key.md) about where to find it on the website. Once you have it, then
API token. Please see [Provide your API Token](../how-to/api-token.md) about how to create and supply it. Once you have it, then
put it into a file in your home directory:

cd ~
Expand Down Expand Up @@ -66,8 +66,8 @@ virtualenv if not installed:

If you want to write data, then for experimentation, do not use the
production HDX server. Instead use the HDX demo server. Assuming you have
an API key for demo stored in a file **.hdxkey** in the current user's home
directory:
an API token for demo stored as **hdx_key_demo** in **.hdx_configuration.yaml** in
the current user's home directory:

Configuration.create(hdx_site="demo", user_agent="MyOrg_MyProject")

Expand All @@ -93,7 +93,7 @@ virtualenv if not installed:
url, path = resources[0].download()
print("Resource URL %s downloaded to %s" % (url, path))

13. If you have an API key, you can write to HDX. You can try it out on the demo
13. If you have an API token, you can write to HDX. You can try it out on the demo
server. With a dataset to which you have permissions, change the dataset date:

dataset = Dataset.read_from_hdx("ID OR NAME OF DATASET")
Expand All @@ -102,7 +102,7 @@ virtualenv if not installed:
print(dataset.get_time_period())
dataset.update_in_hdx()

14. You can view it on HDX before changing it back (if you have an API key):
14. You can view it on HDX before changing it back (if you have an API token):

dataset.set_time_period("PREVIOUS DATE")
dataset.update_in_hdx()
Expand Down
6 changes: 3 additions & 3 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading