File tree Expand file tree Collapse file tree 8 files changed +29
-7
lines changed Expand file tree Collapse file tree 8 files changed +29
-7
lines changed Original file line number Diff line number Diff line change 1
1
import json
2
+ from urllib .parse import unquote
2
3
3
4
def output (result , headers = {}):
4
5
status = 200 if result .success () else 400
@@ -13,5 +14,6 @@ def convert_to_hashes(arr):
13
14
return hashes_arr
14
15
15
16
def convert_to_array (data_string ):
16
- list = data_string .split (',' )
17
+ decoded_data = unquote (data_string )
18
+ list = decoded_data .split (',' )
17
19
return list
Original file line number Diff line number Diff line change 1
1
import json
2
+ from urllib .parse import unquote
2
3
3
4
def output (result , headers = {}):
4
5
status = 200 if result .success () else 400
@@ -13,5 +14,6 @@ def convert_to_hashes(arr):
13
14
return hashes_arr
14
15
15
16
def convert_to_array (data_string ):
16
- list = data_string .split (',' )
17
+ decoded_data = unquote (data_string )
18
+ list = decoded_data .split (',' )
17
19
return list
Original file line number Diff line number Diff line change 2
2
import json
3
3
from google .cloud import firestore
4
4
from .result import Result
5
+ from .utils import convert_to_array
5
6
6
7
DB = firestore .Client (project = os .environ .get ('PROJECT' ), database = os .environ .get ('DATABASE' ))
7
8
@@ -14,11 +15,14 @@ def list_data(params):
14
15
query = query .where ('date' , '>=' , params ['start' ])
15
16
if 'end' in params :
16
17
query = query .where ('date' , '<=' , params ['end' ])
17
-
18
+
18
19
if 'geo' in params :
19
20
query = query .where ('geo' , '==' , params ['geo' ])
21
+
20
22
if 'technology' in params :
21
- query = query .where ('technology' , '==' , params ['technology' ])
23
+ params_array = convert_to_array (params ['technology' ])
24
+ query = query .where ('technology' , 'in' , params_array )
25
+
22
26
if 'rank' in params :
23
27
query = query .where ('rank' , '==' , params ['rank' ])
24
28
Original file line number Diff line number Diff line change 1
1
import json
2
+ from urllib .parse import unquote
2
3
3
4
def output (result , headers = {}):
4
5
status = 200 if result .success () else 400
@@ -11,3 +12,8 @@ def convert_to_hashes(arr):
11
12
hash_dict = {inner_arr [0 ]: inner_arr [1 ]}
12
13
hashes_arr .append (hash_dict )
13
14
return hashes_arr
15
+
16
+ def convert_to_array (data_string ):
17
+ decoded_data = unquote (data_string )
18
+ list = decoded_data .split (',' )
19
+ return list
Original file line number Diff line number Diff line change 1
1
import json
2
+ from urllib .parse import unquote
2
3
3
4
def output (result , headers = {}):
4
5
status = 200 if result .success () else 400
@@ -13,5 +14,6 @@ def convert_to_hashes(arr):
13
14
return hashes_arr
14
15
15
16
def convert_to_array (data_string ):
16
- list = data_string .split (',' )
17
+ decoded_data = unquote (data_string )
18
+ list = decoded_data .split (',' )
17
19
return list
Original file line number Diff line number Diff line change @@ -17,9 +17,11 @@ def list_data(params):
17
17
query = query .where ('date' , '<=' , params ['end' ])
18
18
if 'geo' in params :
19
19
query = query .where ('geo' , '==' , params ['geo' ])
20
+
20
21
if 'technology' in params :
21
22
params_array = convert_to_array (params ['technology' ])
22
23
query = query .where ('technology' , 'in' , params_array )
24
+
23
25
if 'rank' in params :
24
26
query = query .where ('rank' , '==' , params ['rank' ])
25
27
Original file line number Diff line number Diff line change 1
1
import json
2
+ from urllib .parse import unquote
2
3
3
4
def output (result , headers = {}):
4
5
status = 200 if result .success () else 400
@@ -13,5 +14,6 @@ def convert_to_hashes(arr):
13
14
return hashes_arr
14
15
15
16
def convert_to_array (data_string ):
16
- list = data_string .split (',' )
17
+ decoded_data = unquote (data_string )
18
+ list = decoded_data .split (',' )
17
19
return list
Original file line number Diff line number Diff line change 1
1
import json
2
+ from urllib .parse import unquote
2
3
3
4
def output (result , headers = {}):
4
5
status = 200 if result .success () else 400
@@ -13,5 +14,6 @@ def convert_to_hashes(arr):
13
14
return hashes_arr
14
15
15
16
def convert_to_array (data_string ):
16
- list = data_string .split (',' )
17
+ decoded_data = unquote (data_string )
18
+ list = decoded_data .split (',' )
17
19
return list
You can’t perform that action at this time.
0 commit comments