File tree Expand file tree Collapse file tree 3 files changed +11
-2
lines changed Expand file tree Collapse file tree 3 files changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -27,7 +27,8 @@ def debug_task(self):
27
27
28
28
29
29
@app .task
30
- def process_image_task (image_filename ):
30
+ def process_image_task (image_filename , fcm_token ):
31
+ print (f'token: { fcm_token } ' )
31
32
sgf_filename = f'{ Path (image_filename ).stem } .sgf'
32
33
sgf_path = settings .SGF_DIR / sgf_filename
33
34
with open (image_filename , 'rb' ) as image_file :
Original file line number Diff line number Diff line change @@ -28,11 +28,13 @@ def capture(request):
28
28
@require_POST
29
29
def capture_async (request ):
30
30
image_file = request .FILES ['image' ]
31
+ fcm_token = request .POST ['fcm_registration_token' ]
32
+ print (f'token: { fcm_token } ' )
31
33
filename = Path (image_file .name )
32
34
output_path = settings .IMAGES_DIR / filename
33
35
with output_path .open ('wb' ) as output_file :
34
36
output_file .write (image_file .read ())
35
- process_image_task .delay (str (output_path .absolute ()))
37
+ process_image_task .delay (str (output_path .absolute ()), fcm_token )
36
38
return HttpResponse (status = 201 )
37
39
38
40
Original file line number Diff line number Diff line change @@ -16,6 +16,12 @@ Content-Type: image/jpeg
16
16
POST {{protocol }}{{host }}:{{port}}/capture_async/
17
17
Content-Type: multipart/form-data; boundary=WebAppBoundary
18
18
19
+ --WebAppBoundary
20
+ Content-Disposition: form-data; name="fcm_registration_token"
21
+ Content-Type: text/plain
22
+
23
+ foobar
24
+
19
25
--WebAppBoundary
20
26
Content-Disposition: form-data; name="image"; filename="board.jpg"
21
27
Content-Type: image/jpeg
You can’t perform that action at this time.
0 commit comments