File tree Expand file tree Collapse file tree 1 file changed +10
-7
lines changed Expand file tree Collapse file tree 1 file changed +10
-7
lines changed Original file line number Diff line number Diff line change 31
31
# Redistribution and use in source and binary forms, with or without
32
32
# modification, are permitted provided that the following conditions are met:
33
33
#
34
+ from tempfile import TemporaryDirectory
35
+
34
36
from flask import request , Response
35
37
from flask_restful import Resource
36
38
from servicex_codegen .code_generator import CodeGenerator
@@ -44,14 +46,15 @@ def make_api(cls, code_generator: CodeGenerator):
44
46
45
47
def post (self ):
46
48
try :
47
- code = request .data .decode ('utf8' )
48
- zip_data = self .code_generator .generate_code (code )
49
+ with TemporaryDirectory () as tempdir :
50
+ code = request .data .decode ('utf8' )
51
+ zip_data = self .code_generator .generate_code (code , cache_path = tempdir )
49
52
50
- # Send the response back to you-know-what.
51
- response = Response (
52
- response = zip_data ,
53
- status = 200 , mimetype = 'application/octet-stream' )
54
- return response
53
+ # Send the response back to you-know-what.
54
+ response = Response (
55
+ response = zip_data ,
56
+ status = 200 , mimetype = 'application/octet-stream' )
57
+ return response
55
58
except BaseException as e :
56
59
print (str (e ))
57
60
import traceback
You can’t perform that action at this time.
0 commit comments