def get_playground_images_by_category(source, category=None, offset=0, limit=100): image_api = Images() res = GetImagesByCategoryResponse() try: res_data = GetImagesByCategoryResponseData() count = image_api.get_images_count_by_category_name( category_name=category) images = image_api.get_images_by_category_name( category_name=category, offset=offset, limit=limit) res_data.total_count = count imgs = [] for i in images: i['id'] = i.get('_id') imgs.append(ImageDataset().from_dict(i)) res_data.images = imgs res.message = "Successful" res.data = res_data response_status = 200 except Exception as e: log.error(str(e)) res.message = str(e) response_status = 400 return res, response_status
from __future__ import print_function from stylelens_dataset.images import Images from pprint import pprint # create an instance of the API class api_instance = Images() try: offset = 0 limit = 10 res = api_instance.get_images_by_category_name("Blouse", offset=offset, limit=limit) pprint(res) except Exception as e: print("Exception when calling get_images_by_category_name: %s\n" % e)