Advertisement
Guest User

Untitled

a guest
May 16th, 2019
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. from tornado.ioloop import IOLoop
  2.  
  3. from api import db
  4. from api.users.user_purchases.actions.driver import queue_message_for_action
  5. from api.users.user_purchases.actions.constants import UserPurchaseActions
  6.  
  7. USER_PURCHASE_IDS = [
  8. # Add purchase IDs with unsent emails here.
  9. ]
  10.  
  11. if __name__ == '__main__':
  12. session = db.Session()
  13. total = len(USER_PURCHASE_IDS)
  14.  
  15. # Generate report
  16. for i, user_purchase_id in enumerate(USER_PURCHASE_IDS):
  17. IOLoop.current().run_sync(
  18. lambda: queue_message_for_action(session, user_purchase_id, UserPurchaseActions.NOTIFY_FULFILLED_EMAIL)
  19. )
  20. print('[{}/{}] queued message for user_purchase {}'.format(i, total, user_purchase_id))
  21.  
  22. print('Done')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement