Skip to content

Commit

Permalink
Merge pull request #255 from maximlamare/batch_docs
Browse files Browse the repository at this point in the history
Make the instructions about credential setting clearer
  • Loading branch information
AleksMat committed Sep 30, 2020
2 parents 1c47ff6 + 690bda3 commit b65c6dd
Showing 1 changed file with 30 additions and 5 deletions.
35 changes: 30 additions & 5 deletions examples/batch-processing/HowToLULC_batch.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,24 @@
"Run `Batch Processing API` to request data for an area of interest, and download the satellite products (bands and derived products) to an Amazon S3 Bucket."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Sentinel Hub authentification and token\n",
"\n",
"In the following cells, we will set up the authentication parameters for the Sentinel Hub services. \n",
"\n",
"For the steps that use `eo-learn`, such as the conversion of the Bucket contents to EOPatches, we will use the convenient `SHConfig` class from the `sentinelhub-py` package. If you have already set up your credentials in the command line (see [documentation](https://sentinelhub-py.readthedocs.io/en/latest/configure.html#configuration)), then calling `SHConfig` should fill your variable with the necessary attributes allowing you to be identified. If you prefer assigning your credentials \"one-time\" in this workflow you can then assign the four following attributes in the class:\n",
"\n",
"- config.sh_client_id\n",
"- config.sh_client_secret\n",
"- config.aws_access_key_id\n",
"- config.aws_secret_access_key\n",
"\n",
"You can set these parameters directly in the code, or if you want to safely share your code, import them from a file and assign them to the `SHConfig` class."
]
},
{
"cell_type": "code",
"execution_count": 2,
Expand All @@ -111,6 +129,13 @@
}
],
"source": [
"# If you were to assign your credentials in the code (it is better practice to call them\n",
"# from a file), you would uncomment the lines below:\n",
"#config.sh_client_id = \"my-sh-client-id\"\n",
"#config.sh_client_secret = \"my-sh-client-secret\"\n",
"#config.aws_access_key_id = \"my-amazon-client-id\"\n",
"#config.aws_secret_access_key = \"my-amazon-client-secret\"\n",
"\n",
"# Fetch information from the configuration tool python class\n",
"config = SHConfig()"
]
Expand All @@ -119,9 +144,9 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"### Sentinel Hub authentification and token\n",
"To authentify with the `Batch Processing API`, we will need an access token. We configure the token with the crendetials we used in the `SHConfig` class in the cell above.\n",
"\n",
"In the following cell, we will set up the authentication parameters for the Sentinel Hub services. Using the credentials specified in the `config_file.py` file, the code fetches an access token. Tokens do not last forever and run out after a while. If you get a message of type ` accessToken signature expired`, just re-run the next cell. See more [information here](https://docs.sentinel-hub.com/api/latest/api/overview/authentication/)"
"Tokens do not last forever and run out after a while. If you get a message of type ` accessToken signature expired`, just re-run the next cell. See more [information here](https://docs.sentinel-hub.com/api/latest/api/overview/authentication/)"
]
},
{
Expand Down Expand Up @@ -3762,9 +3787,9 @@
],
"metadata": {
"kernelspec": {
"display_name": "EOLearn",
"display_name": "Python 3",
"language": "python",
"name": "eolearn"
"name": "python3"
},
"language_info": {
"codemirror_mode": {
Expand All @@ -3776,7 +3801,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.6"
"version": "3.8.5"
}
},
"nbformat": 4,
Expand Down

0 comments on commit b65c6dd

Please sign in to comment.