Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def rfc_reminder(bot, update):
- get_url = base_url + '/api_usd/rfc/'
- r = requests.get(get_url, auth=(username, password), timeout=timeout, params={'Group_Name':'R.Linux', 'change_closedate': 'null', 'page_size': 1000 } )
- result = r.json()
- tickets = json.dumps(result, indent=4)
- decoded_data = json.loads(tickets)
- for dec in decoded_data['objects']:
- if dec['change_status'] == 'Approved to Implement':
- tenant = dec['organization']
- assignee = dec['assignee_full_name']
- start = dec['Implementation_Start_Date_timestamp']
- end = dec['Implementation_End_Date_timestamp']
- rfc = dec['change_ref']
- summary = dec['change_summary']
- assignee = dec['assignee_full_name']
- now = int(time.time())
- try:
- if int(start-now) / 60 == 30:
- if assignee != ' ':
- tick = '** RFC ' + str(rfc) + ' | ' + summary + ' ** will start in 30 minutes! Assignee: ' + assignee
- bot.send_message(chat_id='60914075', text=str(tick)) # ALEX M
- bot.send_message(chat_id='-1001404840767', text=str(tick)) # LINUX GROUP
- else:
- tick = '** RFC ' + str(rfc) + ' | ' + summary + ' ** will start in 30 minutes! No engineer assigned!'
- bot.send_message(chat_id='60914075', text=str(tick)) # ALEX M
- bot.send_message(chat_id='-1001404840767', text=str(tick)) # LINUX GROUP
- except:
- pass
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement