Skip to content

Commit f0f9cc5

Browse files
committed
Adding docs about get_api_token.py
1 parent 17a199e commit f0f9cc5

1 file changed

Lines changed: 30 additions & 0 deletions

File tree

README.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,36 @@ All of the steps above can be automated on an fresh installation of Dataverse on
4747

4848
For more information on spinning up Dataverse on AWS (especially if you don't have the `aws` executable installed), see http://guides.dataverse.org/en/latest/developers/deployment.html
4949

50+
## Usage in automated processes without API key
51+
Sometimes you don't want to retrieve an API key manually, like at demo times
52+
or when you do automatic deployments of sample data.
53+
54+
For these cases, a script `get_api_token.py` has been added for your convenience.
55+
56+
You can use it like follows (just an example):
57+
```
58+
API_TOKEN=`python get_api_token.py` python create_sample_data.py
59+
```
60+
61+
The script understands two additional environment variables (in addition to
62+
those from `dvconfig.py`):
63+
* `DATAVERSE_USER`
64+
* Username of the user whos API token we want to retrieve
65+
* Defaults to `dataverseAdmin`
66+
* `DATAVERSE_PASSWORD`
67+
* either a cleartext password or a path to a file containing the clear text
68+
password for the user.
69+
* Defaults to `admin1` (usable for dataverse-ansible and dataverse-kubernetes)
70+
71+
In case of a successfull retrieval, it will print the password to standard out.
72+
Error will be written to standard error, so you will see it at the top of
73+
a failed attempt to load the data.
74+
75+
Please be aware that you will have to enable
76+
[:AllowApiTokenLookupViaApi](http://guides.dataverse.org/en/latest/installation/config.html#allowapitokenlookupviaapi)
77+
configuration option in your Dataverse to use this script. You can disable
78+
after deploying the data, no harm done.
79+
5080
## Contributing
5181

5282
We love contributors! Please see our [Contributing Guide][] for ways you can help.

0 commit comments

Comments
 (0)