File tree Expand file tree Collapse file tree 2 files changed +8
-8
lines changed Expand file tree Collapse file tree 2 files changed +8
-8
lines changed Original file line number Diff line number Diff line change 15
15
# specific language governing permissions and limitations
16
16
# under the License.
17
17
#
18
- import nuvolaris .config as cfg
19
- import nuvolaris .couchdb_util as cu
20
- import logging , json
18
+ import json
19
+ from base64 import b64decode
21
20
21
+ from command .psql import Psql
22
22
from common .authorize import Authorize
23
23
from common .command_data import CommandData
24
- from command .psql import Psql
25
- from base64 import b64decode
24
+
26
25
27
26
class ApiError (Exception ):
28
27
pass
@@ -60,10 +59,10 @@ def main(args):
60
59
WARNING: the body will be received as base64 encoded string as this action will be deployed with --web raw enabled flag
61
60
"""
62
61
headers = args ['__ow_headers' ]
63
- if ( 'x-impersonate-auth' not in headers ) :
62
+ if 'x-impersonate-auth' not in headers :
64
63
return build_error ("invalid request, missing mandatory header: x-impersonate-auth" )
65
64
66
- if ( len (args ['__ow_body' ]) == 0 ) :
65
+ if len (args ['__ow_body' ]) == 0 :
67
66
return build_error ("invalid request, no command payload received" )
68
67
69
68
try :
Original file line number Diff line number Diff line change 21
21
22
22
from common .command_data import CommandData
23
23
from psycopg .rows import dict_row
24
+ import json
24
25
25
26
class Psql ():
26
27
"""
@@ -52,7 +53,7 @@ def _query(self, input:CommandData):
52
53
with conn .cursor (row_factory = dict_row ) as cur :
53
54
cur .execute (query )
54
55
result = cur .fetchall ()
55
- input .result (str (result ))
56
+ input .result (json . dumps (result ))
56
57
input .status (200 )
57
58
return input
58
59
You can’t perform that action at this time.
0 commit comments