-
Notifications
You must be signed in to change notification settings - Fork 0
Installation
To install this API on your enviroment, please install requirements for Django: https://docs.djangoproject.com/en/3.0/topics/install/
Install required libraries:
-
pip install wheel
(There can be issues when installing rest-framework if wheel is not installed pip install pycryptodome==3.4.3
pip install crypto
pip install Crypto
pip install requests
pip install urllib
pip install djangorestframework
Configuration setup:
- Navigate to the project's root, and enter this command:
python cmd_utils/genkey.py
, you'll get a secret key to terminal. Copy that value, and place it insettings.py
'sSECRET_KEY
value (i.e.SECRET_KEY = 'YOUR_GENERATED_KEY'
) - Copy/rename file
notifier.example.py
tonotifier.py
Configure notifier.py
These are available settings to configure:
This boolean will enable to check if apikey is included and correct using the API_KEYS
string array, which contains all API keys that you define
This array should contain String API keys if API_KEY_CHECK_ENABLED
is set to true. Include one of defined keys to apikey
parameter in your API requests. Otherwise request gets blocked because of missing or invalid apikey
This boolean enables or disables the Django Administration site, which you can access at /admin
if enabled
When client gives its FCM Key (Instance ID), API can validate if the key is yours by checking if it exists, and is created from allowed source which you define in VALID_CLIENT_PACKAGES
This array should contain Android App's package names if VALIDATE_CLIENT_KEY
is set to true. You should define your own apps package names which needs notifier REST Api to deny access from other apps.
By default there are some routines that Wilma Plus supports. You can add your own by defining its package name, and class name like shown in the example ({'package': 'routines.exams', 'class': 'Exams'}
)
In order to send Push messages to the client, you need to fill in your Firebase Cloud Messaging Server Key. You can find it in Firebase Control Panel (Project Settings -> Cloud Messaging)
In order to verify FCM Keys (Instance IDs), you need to fill in your Firebase Cloud Messaging API key. You can find it in Firebase Control Panel (Project Settings -> Cloud Messaging)
These should be unchanged, as they are API URLs to Google's API servers