Commit Graph

16 Commits

Author SHA1 Message Date
Sergi Delgado Segura
472efd847b Typos 2020-04-20 17:01:55 +02:00
Sergi Delgado Segura
bed21e9625 Adds API HOST and PORT as configurable parameters.
Uses API_BIND/API_PORT for the server and API_CONNECT/API_PORT for the user, for consistency.
2020-04-20 17:01:55 +02:00
Sergi Delgado Segura
4a65b2524b Refactors cli to avoid multi-type returns (normal return + None). Adds exceptions for errors. 2020-04-20 16:06:38 +02:00
Sergi Delgado Segura
5f7eb9df10 Minor fixes 2020-04-20 13:58:09 +02:00
Turtle
b6b95a9821 Add get_all_appointments cli command 2020-04-17 15:17:11 -04:00
Sergi Delgado Segura
39f2628b79 Fixes docs and adds register help 2020-04-02 15:15:45 +02:00
Sergi Delgado Segura
b93aa64827 Patches unchanged variable after renaming in 3e32d8a85e 2020-04-02 10:02:11 +02:00
Sergi Delgado Segura
3e32d8a85e Fixes typo in variable and inconsistent return type 2020-03-31 16:54:52 +02:00
Sergi Delgado Segura
b56123055d Adds flake8 and fixes style issues 2020-03-31 13:06:44 +02:00
Sergi Delgado Segura
f8cc099696 Adds register command to cli, modifies get_appointment to work with POST, refactors cli to improve modularity and cleaning the code
- Adds register command
- Modifies get_appointment command to work with POST + adds signature
- Avoids passing config dict to functions if not necessary (passing single parameters instead)
- Moves key loading to main since most of the commands will need the keys now
- Refactors post_appointment and process_post_appointment_request to work with any post request, so it can be reused for both register and get_appointment
- Functions have been rearanged in a more logical order
- Error handling has been improved
2020-03-30 22:20:01 +02:00
Sergi Delgado Segura
dd53ad68fb Fixes bug when dealing with empty JSON requests or empty appointment field
When posting a request via requests.post the json field was dumped to json, but it shouldn't have been since requests deals with this internally. That meant that the requests made by the code didn't match proper JSON.
In line with this, the API was only parsing this type POST requests correctly, making add_appointment to fail if a proper formatted JSON was passed.

On top of that, empty appointments were not checked in the Inspector before trying to get data from them, making it crash if a JSON was posted to add_appointment not containing the `appointment` field. Unit tests for this should be added.
2020-03-24 20:17:03 +01:00
Sergi Delgado Segura
6ee04bd303 Sets add_appointment_endpoint from / to /add_appointment for consistency
Also passes the base_url to add_appointment and get_appointment and builds the full endpoint inside (also for consistency)
2020-03-24 19:03:41 +01:00
Sergi Delgado Segura
d21e947e05 Moves cli show_usage to help.py 2020-03-23 17:15:46 +01:00
Sergi Delgado Segura
f5edaf1bf0 Fixes default HOST to remove the schema from config
The schema now defaults to http if none is defined. Also improves some of the cli docstrings
2020-03-23 17:15:43 +01:00
Sergi Delgado Segura
3d389a92ac Refactors cli to use the new config approach. Adds template.conf 2020-03-21 22:13:22 +01:00
Sergi Delgado Segura
5e5ff0278a Removes apps folder 2020-03-18 12:09:58 +01:00