Overview
Download the Files
There are two key files for running this test
Bulk_Download.py
Config.ini
Get Your API Key
Follow the steps listed here to download the API Key for your account. For full reference, check out https://esharesearch.atlassian.net/wiki/spaces/GGA/pages/3293282331/Getting+Started+with+the+Trustwell+Genesis+Foods+GraphQL+API#Obtaining-your-API-Key
Only Administrators with API Access will have the ability to generate an API Key.
Treat your API Key like a password. Keep it secret; keep it safe.
Log into the Genesis Foods application.
In the lower left, click the vertical ellipsis next to your Organization Name / Username.
Select Profile.
Select API Tokens along the top.
Click Create API Token.
Enter a Label.
Click Create Token.
Once created, we recommend using the Copy button to copy the string to the clipboard. We will need to save this API Key in the configuration file in the next step.
Update the Configuration Files
The configuration file config.ini
contains settings that will be used in the export process. The list of key settings necessary for this script is found below. There are 4 keys
Setting | Value |
---|---|
| For production use cases, use For working against the preview environment, use |
| The API key you obtained from Genesis Foods in the section above. |
| The name of the CSV file you’d like to save the results to. Defaults to |
| Limits the number of recipes that will be output to a CSV file. Set this to a lower number for testing purposes. If not present, will default to |
MacOS Instructions
One-Time System Setup
Python is already installed by default on MacOS, so we just need to install a few plugins to help the script work.
You only need to do this once, regardless of how often you plan to use the export process.
1 | Open the Terminal application. You can do this from your dock or through Spotlight search by clicking on command+spacebar. | |
2 | Let’s next check the command to launch Python, as it may vary depending on your OS version. Issue the commands
to see which Python executable we have installed. In the example on the right, our Python executable is | |
3 | Similarly, we’ll need to check the path for
to see which | |
4 | Now we need to download a plugin - issue the command
|
We’re now ready to run the export script!
Running the Export Script
1 | Change to the directory you downloaded the file | |
2 | Run the command |
If you receive an error that looks like ImportError: urllib3 v2.0 only supports OpenSSL 1.1.1+, currently the 'ssl' module is compiled with 'OpenSSL 1.0.2r 26 Feb 2019'
then you will need to issue two additional commands to continue the setup process (just once)
pip uninstall urllib3
pip install 'urllib3<2.0'
Once this is complete, the script should be able to run to completion.