()
| 5 | recommend_blueprint = Blueprint('recommend', __name__) |
| 6 | |
| 7 | def extract_input(): |
| 8 | user_id = long(request.args.get('user_id')) |
| 9 | client = request.args.get('client') |
| 10 | limit = int(request.args.get('limit')) |
| 11 | exclusion_items = request.args.get('exclusion_items') |
| 12 | if not exclusion_items is None and len(exclusion_items) > 0: |
| 13 | exclusion_items_list = map(lambda x: long(x), exclusion_items.split(",")) |
| 14 | else: |
| 15 | exclusion_items_list = [] |
| 16 | recent_interactions = request.args.get('recent_interactions') |
| 17 | if not recent_interactions is None and len(recent_interactions) > 0: |
| 18 | recent_interactions_list = map(lambda x: long(x), recent_interactions.split(",")) |
| 19 | else: |
| 20 | recent_interactions_list = [] |
| 21 | data_keys = request.args.get('data_key') |
| 22 | if not data_keys is None: |
| 23 | data_keys_list = map(lambda x: str(x), data_keys.split(",")) |
| 24 | else: |
| 25 | data_keys_list = [] |
| 26 | input = { |
| 27 | "user_id" : user_id, |
| 28 | "client" : client, |
| 29 | "limit" : limit, |
| 30 | "exclusion_items_list" : exclusion_items_list, |
| 31 | "recent_interactions_list": recent_interactions_list, |
| 32 | "data_keys_list": data_keys_list |
| 33 | } |
| 34 | return input |
| 35 | |
| 36 | def format_recs(recs): |
| 37 | formatted_recs_list=[] |
no test coverage detected