title |
---|
Contentful Upload Script |
Disclaimer: This script was tested on MacOS only. It depends on MacOS
security
utility.
The script contentful_upload
is used to upload files as Assets to Contentful.
You need to have a Contentful account and one Content Management API Key.
- Clone this repository
- Copy or rename
.env.local.template
to.env.local
- Paste your API keys into `.env.local``
CONTENTFUL_SPACE_ID="cccc" CONTENTFUL_ENV="master" CONTENTFUL_API_KEY="dssdsd"
- Execute
deploy.sh
Once you completed the deployment steps, you can call contentful_upload
from the terminal, passing the arguments.
-i, --input
A filename or a directory to upload.-t, --title
A title to set to the Asset.
Running deploy.sh
will perform the following tasks:
- Copy
src/contentful_upload.py
to$HOME/usr/.local/bin
(removing the py extension) - Make the file
contentful_upload
executable - Fetch the key-value pairs from from
.env.local
and store them in MacOS key chain as generic passwords.
- The functionality to upload text content is not yet implemented.
- A btter approach for the
deployment
would be fordeploy.sh
to ask for the credentials in the terminal, so the secret is not stored in.env.local