
now the server accepts more forms of data, like accelometer, gyroscope, orientation, and azimuth
@b36a3c42004293b2456ed7a1bff8506c767ca7cc
+++ app.py
... | ... | @@ -0,0 +1,31 @@ |
1 | +from flask import Flask, request, abort, jsonify | |
2 | +from flask_restx import Api | |
3 | +from flask_cors import CORS | |
4 | +from auth import Auth | |
5 | +from action import Action | |
6 | +from flask_caching import Cache | |
7 | +import json | |
8 | + | |
9 | +app = Flask(__name__) | |
10 | +CORS(app) | |
11 | +cache = Cache(app, config={'CACHE_TYPE': 'simple'}) | |
12 | + | |
13 | +print("Api Start") | |
14 | +api = Api(app, | |
15 | + version='0.1', | |
16 | + title="PM_logger", | |
17 | + description="API Server", | |
18 | + terms_url="/", | |
19 | + contact="yjyoon@takensoft.co.kr", | |
20 | + license="") | |
21 | + | |
22 | +print("Api Started") | |
23 | + | |
24 | +api.add_namespace(Auth, '/auth') | |
25 | +print("Api Add Auth") | |
26 | + | |
27 | +api.add_namespace(Action, '/action') | |
28 | + | |
29 | +if __name__ == "__main__": | |
30 | + app.run(debug=True, host='0.0.0.0', port=27461) | |
31 | + print("Flask Start") |
+++ unit_test_insert_gps_command.sh
... | ... | @@ -0,0 +1,75 @@ |
1 | +curl -d '{ | |
2 | + "user_id":"testaccountsingle", | |
3 | + "trip_id":"1a3db65c589afaffd8cb7f7eae6ab53ffecde6f3d96bd8a0d8686070f44dfac3", | |
4 | + "trip_log": { | |
5 | + "latitude":[37.778282], | |
6 | + "longitude":[128.129373], | |
7 | + "timestamp":["2024-07-11 16:23:19.667"] | |
8 | + } | |
9 | +}' -H "Content-Type: application/json" -X POST http://192.168.0.195:15857/action/gps_update | |
10 | + | |
11 | + | |
12 | + | |
13 | +curl -d '{ | |
14 | + "user_id":"testaccountdouble", | |
15 | + "trip_id":"7e46b2c35651611a5269f0f9190b02b80866a76bc7e457fab32ef5ff65b492bc", | |
16 | + "trip_log": { | |
17 | + "latitude":[37.778282, 37.778300], | |
18 | + "longitude":[128.129373, 128.129400], | |
19 | + "timestamp":["2024-07-11 16:23:19.667", "2024-07-11 16:30:43.175"] | |
20 | + } | |
21 | +}' -H "Content-Type: application/json" -X POST http://192.168.0.195:15857/action/gps_update | |
22 | + | |
23 | +curl -d '{ | |
24 | + "user_id":"testaccountinvaliduserid", | |
25 | + "trip_id":"edgecase_test", | |
26 | + "trip_log": { | |
27 | + "latitude":[37.778282, 37.778300], | |
28 | + "longitude":[128.129373, 128.129400], | |
29 | + "timestamp":["2024-07-11 16:23:19.667", "2024-07-11 16:30:43.175"] | |
30 | + } | |
31 | +}' -H "Content-Type: application/json" -X POST http://192.168.0.195:15857/action/gps_update | |
32 | + | |
33 | + | |
34 | +curl -d '{ | |
35 | + "user_id":"testaccount-fifteen", | |
36 | + "trip_id":"9911c80c165b85c7cfbaedd89cb0e0d39bea6d7eb93cadab9b264abc350bb888", | |
37 | + "trip_log": { | |
38 | + "latitude":[37.778282, 37.778283, 37.778284, 37.778285, 37.778286, 37.778287, 37.778288, 37.778289, 37.778290, 37.778291, 37.778292, 37.778293, 37.778294, 37.778295, 37.778296], | |
39 | + "longitude":[128.129373, 128.129374, 128.129375, 128.129376, 128.129377, 128.129378, 128.129379, 128.129380, 128.129381, 128.129382, 128.129383, 128.129384, 128.129385, 128.129386, 128.129387], | |
40 | + "timestamp":["2024-07-11 16:23:19.667", "2024-07-11 16:24:19.667", "2024-07-11 16:25:19.667", "2024-07-11 16:26:19.667", "2024-07-11 16:27:19.667", "2024-07-11 16:28:19.667", "2024-07-11 16:29:19.667", "2024-07-11 16:30:19.667", "2024-07-11 16:31:19.667", "2024-07-11 16:32:19.667", "2024-07-11 16:33:19.667", "2024-07-11 16:34:19.667", "2024-07-11 16:35:19.667", "2024-07-11 16:36:19.667", "2024-07-11 16:37:19.667"] | |
41 | + } | |
42 | +}' -H "Content-Type: application/json" -X POST http://192.168.0.195:15857/action/gps_update | |
43 | + | |
44 | + | |
45 | +curl -d '{ | |
46 | + "user_id":"testaccount-mismatchlen-long", | |
47 | + "trip_id":"9911c80c165b85c7cfbaedd89cb0e0d39bea6d7eb93cadab9b264abc350bb888", | |
48 | + "trip_log": { | |
49 | + "latitude":[37.778282, 37.778283, 37.778284, 37.778285, 37.778286, 37.778287, 37.778288, 37.778289, 37.778290, 37.778291, 37.778292, 37.778293, 37.778294, 37.778295, 37.778296], | |
50 | + "longitude":[128.129373, 128.129374, 128.129375, 128.129376, 128.129377, 128.129378, 128.129379, 128.129380, 128.129381, 128.129382, 128.129383, 128.129384, 128.129385, 128.129386], | |
51 | + "timestamp":["2024-07-11 16:23:19.667", "2024-07-11 16:24:19.667", "2024-07-11 16:25:19.667", "2024-07-11 16:26:19.667", "2024-07-11 16:27:19.667", "2024-07-11 16:28:19.667", "2024-07-11 16:29:19.667", "2024-07-11 16:30:19.667", "2024-07-11 16:31:19.667", "2024-07-11 16:32:19.667", "2024-07-11 16:33:19.667", "2024-07-11 16:34:19.667", "2024-07-11 16:35:19.667", "2024-07-11 16:36:19.667", "2024-07-11 16:37:19.667"] | |
52 | + } | |
53 | +}' -H "Content-Type: application/json" -X POST http://192.168.0.195:15857/action/gps_update | |
54 | + | |
55 | +curl -d '{ | |
56 | + "user_id":"testaccount-mismatchlen-lat", | |
57 | + "trip_id":"9911c80c165b85c7cfbaedd89cb0e0d39bea6d7eb93cadab9b264abc350bb888", | |
58 | + "trip_log": { | |
59 | + "latitude":[37.778282, 37.778283, 37.778284, 37.778285, 37.778286, 37.778287, 37.778288, 37.778289, 37.778290, 37.778291, 37.778292, 37.778293, 37.778294, 37.778295], | |
60 | + "longitude":[128.129373, 128.129374, 128.129375, 128.129376, 128.129377, 128.129378, 128.129379, 128.129380, 128.129381, 128.129382, 128.129383, 128.129384, 128.129385, 128.129386, 128.129387], | |
61 | + "timestamp":["2024-07-11 16:23:19.667", "2024-07-11 16:24:19.667", "2024-07-11 16:25:19.667", "2024-07-11 16:26:19.667", "2024-07-11 16:27:19.667", "2024-07-11 16:28:19.667", "2024-07-11 16:29:19.667", "2024-07-11 16:30:19.667", "2024-07-11 16:31:19.667", "2024-07-11 16:32:19.667", "2024-07-11 16:33:19.667", "2024-07-11 16:34:19.667", "2024-07-11 16:35:19.667", "2024-07-11 16:36:19.667", "2024-07-11 16:37:19.667"] | |
62 | + } | |
63 | +}' -H "Content-Type: application/json" -X POST http://192.168.0.195:15857/action/gps_update | |
64 | + | |
65 | + | |
66 | +curl -d '{ | |
67 | + "user_id":"testaccount-fifteen-timestamp", | |
68 | + "trip_id":"9911c80c165b85c7cfbaedd89cb0e0d39bea6d7eb93cadab9b264abc350bb888", | |
69 | + "trip_log": { | |
70 | + "latitude":[37.778282, 37.778283, 37.778284, 37.778285, 37.778286, 37.778287, 37.778288, 37.778289, 37.778290, 37.778291, 37.778292, 37.778293, 37.778294, 37.778295, 37.778296], | |
71 | + "longitude":[128.129373, 128.129374, 128.129375, 128.129376, 128.129377, 128.129378, 128.129379, 128.129380, 128.129381, 128.129382, 128.129383, 128.129384, 128.129385, 128.129386, 128.129387], | |
72 | + "timestamp":["2024-07-11 16:23:19.667", "2024-07-11 16:24:19.667", "2024-07-11 16:25:19.667", "2024-07-11 16:26:19.667", "2024-07-11 16:27:19.667", "2024-07-11 16:28:19.667", "2024-07-11 16:29:19.667", "2024-07-11 16:30:19.667", "2024-07-11 16:32:19.667", "2024-07-11 16:33:19.667", "2024-07-11 16:34:19.667", "2024-07-11 16:35:19.667", "2024-07-11 16:36:19.667", "2024-07-11 16:37:19.667"] | |
73 | + } | |
74 | +}' -H "Content-Type: application/json" -X POST http://192.168.0.195:15857/action/gps_update | |
75 | + |
Add a comment
Delete comment
Once you delete this comment, you won't be able to recover it. Are you sure you want to delete this comment?