Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SamplePythonDataBridgesCall compilation error #1

Open
ahalma opened this issue Mar 13, 2023 · 1 comment
Open

SamplePythonDataBridgesCall compilation error #1

ahalma opened this issue Mar 13, 2023 · 1 comment

Comments

@ahalma
Copy link

ahalma commented Mar 13, 2023

Hey Valerio,

Thank you for putting up examples on using the DataBridges API!

I believe the SamplePythonDataBridgesCall contains some code at the end that prevents it from compiling... (from line 200).

It seems to be a recipe for creating an API token from a key and a secret. A standalone example to do that with curl would be helpful in it's own right!

@ahalma
Copy link
Author

ahalma commented Mar 17, 2023

In case it comes in handy, here is a bash script, to retrieve the initial API token, given your key and secret.

BASIC_AUTH_USER=mykey
BASIC_AUTH_PASSWORD=mysecret
AUTH=$(echo -ne "$BASIC_AUTH_USER:$BASIC_AUTH_PASSWORD" | base64 --wrap 0)
curl -X POST -d "grant_type=client_credentials&scope=" -H "Authorization: Basic $AUTH" https://api.wfp.org/token

It can be of use in case you decide to use something other than Python to use the API...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant