djc invitation letter generator
To run locally, do the usual:
- Create a Python 3.8 or greater virtualenv
- Install dependencies:
pip install -r requirements.txt
- Create a Google Cloud project here
- Enable Google Docs and Google Sheets APIs
- Create a service account direct link
- Create a new key (json) for the service account you created and download the json file.
export GOOGLE_APPLICATION_CREDENTIALS="<PATH_TO_KEY>" Google Drive
- Create a directory
DJC 2025 Letters
├── templates
├── Invitation(doc)
└── Invitation_letter_requests(sheets)
- Upload your docs & sheets templates or create a template(refer to placeholders for both docs & sheets)
- Get the respective ids and set them as environment variable
Set Environment variable
FOLDER_ID = [Google Drive project parent folder id]
FILE_ID = [ Google Docs file id ]
SPREADSHEET_ID = [Google Sheets file id]
Editor permission. eg. djc@xxxx.iam.gserviceaccount.com
Placeholder in Google Docs {{user}}
- fullname
- address
- letterdate
- passportno
- dateofbirth
- letter-content
Columns in Google Sheets
- Timestamp
- Fullname
- Download Link
Start the app: Run
uvicorn main:app --port 4000 --reload Check the APIs
To play around with the APIs, visit the link on your browser:
http://localhost:4000/docs
Attendee Payload
{
"fullname": "Django Conference",
"address": "125 32nd Street, San Diego, California, USA",
"dob": "May 25, 1950",
"email": "djc@django.com",
"passport_no": "DJC6003434",
}Opportunity Grant Recipient Payload
{
"fullname": "Django Conference",
"address": "125 32nd Street, San Diego, California, USA",
"dob": "May 25, 1950",
"email": "djc@django.com",
"passport_no": "DJC6003434",
"letteropt":{
"key":"og",
"value": "1234.00"
}
}Speaker Payload
{
"fullname": "Django Conference",
"address": "125 32nd Street, San Diego, California, USA",
"dob": "May 25, 1950",
"email": "djc@django.com",
"passport_no": "DJC6003434",
"letteropt":{
"key":"speaker",
"value": "Django is the best framework!"
}
}