| 42 | |
| 43 | |
| 44 | def group_posts(posts, logger): |
| 45 | no_comments_post_ids = [] |
| 46 | light_post_ids = [] |
| 47 | normal_post_ids = [] |
| 48 | heavy_post_ids = [] |
| 49 | for postobj in posts: |
| 50 | try: |
| 51 | if postobj["mode"] == "no_comments": |
| 52 | no_comments_post_ids.append(postobj) |
| 53 | elif postobj["mode"] == "light": |
| 54 | light_post_ids.append(postobj) |
| 55 | elif postobj["mode"] == "heavy": |
| 56 | heavy_post_ids.append(postobj) |
| 57 | else: |
| 58 | normal_post_ids.append(postobj) |
| 59 | except Exception as err: |
| 60 | logger.error( |
| 61 | "Failed with Error {}, please upgrade your instapy".format(err) |
| 62 | ) |
| 63 | normal_post_ids.append(postobj) |
| 64 | return no_comments_post_ids, light_post_ids, normal_post_ids, heavy_post_ids |
| 65 | |
| 66 | |
| 67 | def share_my_post_with_pods(postid, topic, engagement_mode, logger): |