Advertisement
Guest User

Untitled

a guest
Feb 17th, 2020
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.59 KB | None | 0 0
  1. def rfc_reminder(bot, update):
  2. get_url = base_url + '/api_usd/rfc/'
  3. r = requests.get(get_url, auth=(username, password), timeout=timeout, params={'Group_Name':'R.Linux', 'change_closedate': 'null', 'page_size': 1000 } )
  4. result = r.json()
  5. tickets = json.dumps(result, indent=4)
  6. decoded_data = json.loads(tickets)
  7. for dec in decoded_data['objects']:
  8. if dec['change_status'] == 'Approved to Implement':
  9. tenant = dec['organization']
  10. assignee = dec['assignee_full_name']
  11. start = dec['Implementation_Start_Date_timestamp']
  12. end = dec['Implementation_End_Date_timestamp']
  13. rfc = dec['change_ref']
  14. summary = dec['change_summary']
  15. assignee = dec['assignee_full_name']
  16.  
  17. now = int(time.time())
  18. try:
  19. if int(start-now) / 60 == 30:
  20. if assignee != ' ':
  21. tick = '** RFC ' + str(rfc) + ' | ' + summary + ' ** will start in 30 minutes! Assignee: ' + assignee
  22. bot.send_message(chat_id='60914075', text=str(tick)) # ALEX M
  23. bot.send_message(chat_id='-1001404840767', text=str(tick)) # LINUX GROUP
  24. else:
  25. tick = '** RFC ' + str(rfc) + ' | ' + summary + ' ** will start in 30 minutes! No engineer assigned!'
  26. bot.send_message(chat_id='60914075', text=str(tick)) # ALEX M
  27. bot.send_message(chat_id='-1001404840767', text=str(tick)) # LINUX GROUP
  28. except:
  29. pass
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement