How to use send_messages method in localstack

Best Python code snippet using localstack_python

main1.py

Source:main1.py Github

copy

Full Screen

...15session = requests.Session()161718# вывод сообщений в беседу19def send_messages(id1, text, attr=''):20 """2122 :param id1: id того, с кем мы общаемся23 :param text: сообщения для вывода24 :param attr: проверка на пустоту сообщения25 :return:26 """27 random_id = random.randint(0, 1000000)28 if not attr:29 vk.method('messages.send', {'chat_id': id1, 'message': text, 'random_id': random_id})30 else:31 vk.method('messages.send',32 {'chat_id': id1, 'message': text, 'random_id': random_id, 'attachment': attr})333435# имя по ид36def _get_user_name(self, user_id):37 """3839 :param user_id: id пользователя40 :return: Имя пользователя41 """42 request = requests.get("https://vk.com/id" + str(user_id))43 bs = bs4.BeautifulSoup(request.text, "html.parser")44 user_name = str(bs.findAll("title")[0])45 print(user_name.split(' | ')[0])46 return user_name.split()[0][7:]474849# сколько дней до...50def t_d(chat_id, msg):51 """5253 :param chat_id: id чата в котором обрабатывается запрос пользователя54 :param msg: сообщение пользователя55 в ответ возвращаем сообщение по запросу56 """57 try:58 date1 = msg.lower()[16:]59 if date1.lower() == "лета" or date1.lower() == "лето":60 if 5 < datetime.date.today().month < 9:61 send_messages(chat_id, f'Уже лето!')62 date1 = datetime.date.today()63 elif datetime.date.today().month >= 9:64 d = datetime.date.today().year + 165 date1 = datetime.date(d, 6, 1)66 else:67 d = datetime.date.today().year68 date1 = datetime.date(d, 6, 1)69 elif date1.lower() == "весны" or date1.lower() == "весна":70 if 2 < datetime.date.today().month < 6:71 send_messages(chat_id, f'Уже весна!')72 date1 = datetime.date.today()73 elif datetime.date.today().month >= 6:74 d = datetime.date.today().year + 175 date1 = datetime.date(d, 3, 1)76 else:77 d = datetime.date.today().year78 date1 = datetime.date(d, 3, 1)79 elif date1.lower() == "осень" or date1.lower() == "осени":80 if 8 < datetime.date.today().month < 12:81 send_messages(chat_id, f'Уже осень!')82 date1 = datetime.date.today()83 elif datetime.date.today().month >= 12:84 d = datetime.date.today().year + 185 date1 = datetime.date(d, 9, 1)86 else:87 d = datetime.date.today().year88 date1 = datetime.date(d, 9, 1)89 elif date1.lower() == "зима" or date1.lower() == "зимы":90 if (datetime.date.today().month < 3) or (datetime.date.today().month == 12):91 send_messages(chat_id, f'Уже зима!')92 date1 = datetime.date.today()93 else:94 d = datetime.date.today().year95 date1 = datetime.date(d, 12, 1)96 elif date1.lower() == "нового года" or date1.lower() == "новый год":97 d = datetime.date.today().year + 198 date1 = datetime.date(d, 1, 1)99 else:100 inp = date1.split('.')101 if len(inp) != 3:102 send_messages(chat_id, f'Такой даты нет! Может, вы имели в виду сегодня?')103 date1 = datetime.date.today()104 else:105 date1 = [int(x) for x in inp]106 date1 = datetime.date(date1[-1], date1[-2], date1[0])107 cur_date = datetime.date.today()108 delta = date1 - cur_date109 send_messages(chat_id, f'Осталось всего {delta.days} дней. Это не так уж и много')110 except ValueError:111 send_messages(chat_id, f'Неподходящий формат - введите дату в формате дд.мм.гггг')112 except TypeError:113 send_messages(chat_id, f'Ошибка типа сообщения')114115116# слова наоборот117def abirgame(chat_id, word):118 """119120 :param chat_id: id чата в котором обрабатывается запрос пользователя121 :param word: слово которое нам написал пользователь122 :return: Отправляем сообщение либо выходим из функции123 """124 if word.lower() == 'ценок':125 return False126 else:127 send_messages(chat_id, word[::-1])128 return True129130131# верю не верю132def true_or_false(chat_id, inpu, number):133 """134135 :param chat_id: id чата в котором обрабатывается запрос пользователя136 :param inpu: сообщение на вход от пользователя137 :param number: номер карточки вопроса138139 """140 if inpu == 'хватит':141 send_messages(chat_id, 'Ладно, больше не буду')142 return False, 0143 if ans_dict[inpu] == ANS_CARDS[number]:144 send_messages(chat_id, 'Ты прав')145 else:146 send_messages(chat_id, 'Не угадал')147 number = random.randint(0, len(QUE_CARDS) - 1)148 send_messages(chat_id, QUE_CARDS[number])149 return True, number150151152# виселица153def gallows(chat_id, char):154 """155156 :param chat_id: id чата в котором обрабатывается запрос пользователя157 :param char: сообщение пользователя158 :return: возвращаем то, угадал ли пользователь букву159 """160 global nu, visTrue, current_ans, wrong161 char = char.lower()162 if char == 'сдаюсь':163 send_messages(chat_id, 'Вы закончили игру')164 visTrue = False165 send_messages(chat_id, f'Правильный ответ: {ANWERS[nu+1]}')166 return visTrue167 if not char.isalpha() or len(char) != 1:168 send_messages(chat_id, 'Введите одну букву, пожалуйста')169 send_messages(chat_id, ' '.join(current_ans))170 send_messages(chat_id, 'Введите букву: ')171 return visTrue172 if char in current_ans:173 send_messages(chat_id, 'Эта буква уже открыта')174 send_messages(chat_id, ' '.join(current_ans))175 send_messages(chat_id, 'Введите букву: ')176 return visTrue177 elif char in ANWERS[nu].lower() and char not in current_ans:178 for flag in range(len(ANWERS[nu])):179 if char == ANWERS[nu][flag].lower():180 current_ans[flag] = char181 if '-' not in current_ans:182 send_messages(chat_id, f'Правильный ответ: {ANWERS[nu]}')183 send_messages(chat_id, 'Поздравляем, вы выиграли!')184 visTrue = False185 return visTrue186 send_messages(chat_id, ' '.join(current_ans))187 send_messages(chat_id, 'Введите букву: ')188 return visTrue189 else:190 wrong += 1191 if wrong == MAX_WRONG:192 send_messages(chat_id, 'Попыток не осталось. Вы проиграли =((')193 send_messages(chat_id, f'Правильный ответ: {ANWERS[nu]}')194 visTrue = False195 return visTrue196 send_messages(chat_id, f'Такой буквы нет. Осталось попыток: {MAX_WRONG - wrong}')197 send_messages(chat_id, ' '.join(current_ans))198 send_messages(chat_id, 'Введите букву: ')199 return visTrue200201202203def know_nomber(chat_id, text, num, knownumTrue, raund):204 """205206 :param chat_id: id чата в котором обрабатывается запрос пользователя207 :param text: сообщение пользвателя208 :param num: загаданное число209 :param knownumTrue: параметр в списке210 :param raund: номер раунда211212 """213 if text == num:214 send_messages(chat_id, 'Верно! Победа =)) С ' + str(raund) + " попытки")215 return [False, 1]216 elif text < num:217 send_messages(chat_id, 'Больше бери!')218 raund += 1219 else:220 send_messages(chat_id, 'Много! Уменьшай')221 raund += 1222 return knownumTrue, raund223224225# крестики-нолики226def krestnul(p, desk, c):227 """228229 :param p: номер игрока230 :param desk: рисунок нашей доски231 :param c: координаты клетки которую дал пользователь232 :return:233 """234 c = [int(c[0]), int(c[2])]235 if desk[c[0]][c[1]] == '.':236 if p == 1:237 desk[c[0]][c[1]] = '+'238 else:239 desk[c[0]][c[1]] = '0'240 send_messages(chat_id, f' '.join(desk[0]))241 send_messages(chat_id, f' '.join(desk[1]))242 send_messages(chat_id, f' '.join(desk[2]))243 send_messages(chat_id, f' '.join(desk[3]))244 else:245 send_messages(chat_id, 'Неверный ход')246 return 0, desk247 if desk[1][1] == desk[1][2] == desk[1][3] == '+' or desk[2][1] == desk[2][2] == desk[2][248 3] == '+' or \249 desk[3][1] == desk[3][2] == desk[3][3] == '+' or desk[1][1] == desk[2][1] == desk[3][250 1] == '+' or \251 desk[1][2] == desk[2][2] == desk[3][2] == '+' or desk[1][3] == desk[2][3] == desk[3][252 3] == '+' or \253 desk[1][1] == desk[2][2] == desk[3][3] == '+' or desk[3][1] == desk[2][2] == desk[1][254 3] == '+':255 send_messages(chat_id, "Победа 1-ого игрока!")256 return 0, desk257 if desk[1][1] == desk[1][2] == desk[1][3] == '0' or desk[2][1] == desk[2][2] == desk[2][258 3] == '0' or \259 desk[3][1] == desk[3][2] == desk[3][3] == '0' or desk[1][1] == desk[2][1] == desk[3][260 1] == '0' or \261 desk[1][2] == desk[2][2] == desk[3][2] == '0' or desk[1][3] == desk[2][3] == desk[3][262 3] == '0' or \263 desk[1][1] == desk[2][2] == desk[3][3] == '0' or desk[3][1] == desk[2][2] == desk[1][264 3] == '0':265 send_messages(chat_id, "Победа 2-ого игрока!")266 return 0, desk267 return 1, desk268269270271272273def share(a):274 """275 Функция для обработки числа для игры276 :param a: число для обработки277 :return: список чисел278 """279 return a // 1000, (a // 100) % 10, (a % 100) // 10, a % 10280281282def cow(a, b):283 """284 Задаем колнки по заданному интервалу285 :param a: размер286 :param b: размер287288 """289 bull, ccow = 0, 0290 for i in range(4):291 if a[i] == b[i]:292 bull += 1293 elif a[i] in b:294 ccow += 1295 return bull, ccow296297298def change(res):299 global s300 q = list(map(lambda x: [cow(share(x), res), x],301 [i for i in range(1234, 9876) if len(set(str(i))) == 4]))302 w = []303 for elem in q:304 if history(elem[1], s):305 w.append(elem)306 return min(w, key=lambda x: (x[0][0], x[0][1]))[1]307308# история запроса309def history(x, ss):310 for elem in ss:311 if cow(share(x), elem[0]) != elem[1]:312 return False313 return True314315316# игровые переменные317knownumTrue, gorodaTrue, abirTrue, visTrue, tofTrue, bikTrue = False, False, False, False, False, False318raund, raund1, bol, i, number = 0, 0, 0, -1, 0319word_b = ''320cur_towns = []321s = []322desk = [[' ', '1', '2', '3'], ['1', '.', '.', '.'], ['2', '.', '.', '.'], ['3', '.', '.', '.']]323MAX_WRONG = 5324global num325326# запрос в вк327def bik(chat_id, res, normal):328 pass329330if __name__ == '':331 longpoll = VkBotLongPoll(vk, 204241258)332 for event in longpoll.listen():333 print(event.type)334 if event.type == VkBotEventType.MESSAGE_NEW: #Если появилось сообщение - обрабатываем335 if event.from_chat:336 chat_id = event.chat_id337 msg = event.object.message["text"].lower()338 bad_words = ['лень', "тоска", "уныние", "скука"] # слова-маркеры339 if msg == "привет":340 send_messages(chat_id,341 'Привет, чтобы узнать, что я могу пиши "команды"')342 try:343 dey = event.message.action['type']344 invite_id = event.message.action['member_id']345 except:346 dey = ''347 invite_id = -100348 if dey == 'chat_invite_user':349 send_messages(chat_id, f"Приветик, {_get_user_name(chat_id, str(invite_id))}!")350 elif set(msg.split()) & set(bad_words):351 send_messages(chat_id, 'Без плохих слов!')352 elif msg.lower() == "кто я":353 name = _get_user_name(chat_id, str(invite_id))354 if name == '404':355 send_messages(chat_id, f"Я не знаю")356 else:357 send_messages(chat_id, f"Ты - {name}, не забывай об этом!")358 elif msg.lower().count("кто ид - "):359 invite_id = msg.lower().split('кто ид - ')[1]360 name = _get_user_name(chat_id, str(invite_id))361 if name == '404':362 send_messages(chat_id, f"Я не знаю")363 else:364 send_messages(chat_id, f"Это - {name}, не забывай об этом!")365 elif msg.lower().count("добавить фразу"):366 frazes.append(msg[15:])367 send_messages(chat_id, f'Ваша фраза - {msg[15:]} - добавлена в список')368 elif msg.lower() == "команды":369 attachments = []370 image = random.choice(image_urls)371 photo = upload.photo_messages(photos=image)[0]372 attachments.append('photo{}_{}'.format(photo['owner_id'], photo['id']))373 send_messages(chat_id, koms, ','.join(attachments))374 elif msg.lower() == "грустно":375 send_messages(chat_id, f'Все будет окей!)')376 elif msg.lower() == "весело":377 send_messages(chat_id, f'Так держать! Полный вперед! На аборда-аж!')378 elif msg.lower() == "крестики-нолики":379 bol = 1380 i = 1381 send_messages(chat_id,382 f"Да начнется битва! Ход игрока {1}. Введите координату типа: 1 3")383 elif bol and len(msg.lower()) == 3 and set(msg.lower()) & set('123'):384 p = i % 2385 if p == 0:386 p = 2387 c = msg388 bol, desk = krestnul(p, desk, c)389 i += 1390 if bol:391 if p == 2:392 b = 1393 else:394 b = 2395 send_messages(chat_id, f"Ход игрока {b}")396 elif msg.lower() == "угадайка":397 send_messages(chat_id, f'Угадайка. Поехали. ВВедите число')398 num = random.randint(1, 100)399 raund = 1400 knownumTrue = True401 elif knownumTrue and msg.isdigit():402 knownumTrue, raund = know_nomber(chat_id, int(msg), num, knownumTrue, raund)403 elif msg.lower() == "прогноз": # псевдопредсказание дня404 attachments = []405 image = random.choice(im_uri)406 photo = upload.photo_messages(photos=image)[0]407 attachments.append('photo{}_{}'.format(photo['owner_id'], photo['id']))408 send_messages(chat_id, random.choice(futurum), ','.join(attachments))409 elif msg.lower() == 'картинка':410 attachments = []411 image = random.choice(f1)412 photo = upload.photo_messages(photos=image)[0]413 attachments.append('photo{}_{}'.format(photo['owner_id'], photo['id']))414 send_messages(chat_id, '', ','.join(attachments))415 elif msg.lower() == 'фраза':416 send_messages(chat_id, random.choice(frazes))417 elif msg.lower() == "города":418 raund1 = 1419 gorodaTrue = True420 send_messages(chat_id, f'Города. Начинайте с "Город ..."')421 cur_towns = []422 word_b = ''423 elif msg.lower() == "виселица":424 visTrue = True425 send_messages(chat_id,426 f'Ваша задача ответить на загадку, угадывая слово по одной букве. '427 f'Если хотите закончить игру досрочно, напишите "сдаюсь". '428 f'У вас есть право на {MAX_WRONG} ошибок.'429 f' Чтобы ввести букву начните сообщение с "Буква "')430 nu = random.randint(0, len(QUESTIONS) - 1)431 send_messages(chat_id, QUESTIONS[nu])432 wrong = 0433 current_ans = ['-'] * len(ANWERS[nu])434 send_messages(chat_id, ' '.join(current_ans))435 send_messages(chat_id, 'Введите букву: ')436 elif msg.lower().count("буква ") and visTrue:437 letter = msg.lower().split("буква ")[1]438 visTrue = gallows(chat_id, letter)439 elif msg.lower().count("сдаюсь") and visTrue:440 visTrue = gallows(chat_id, 'сдаюсь')441 elif msg.lower().count("сколько дней до"):442 t_d(chat_id, msg)443 elif msg.lower() == "абырвалг":444 abirTrue = True445 send_messages(chat_id, f'Торобоан аволс мешип\n *ценок - конец')446 elif abirTrue:447 abirTrue = abirgame(chat_id, msg)448 elif msg.lower() == "верю не верю":449 tofTrue = True450 send_messages(chat_id, f'Ваша задача угадать, правдиво ли данное высказывание')451 number = random.randint(0, len(QUE_CARDS) - 1)452 send_messages(chat_id, QUE_CARDS[number])453 elif tofTrue and ((msg.lower() in ans_dict) or msg.lower() == 'хватит'):454 tofTrue, number = true_or_false(chat_id, msg.lower(), number)455 elif msg.lower().count('посчитай'):456 msg = msg.split('посчитай ')[1]457 try:458 st = eval(msg)459 send_messages(chat_id, f'Будет: {st}')460 except ZeroDivisionError:461 send_messages(chat_id, f'Ошибка! Делить на 0 нельзя!')462 except TypeError:463 send_messages(chat_id, f'Я тебя не понимаю. Не забудь про ввод цифрами')464 except SyntaxError:465 send_messages(chat_id, f'Я тебя не понимаю. Не забудь про ввод цифрами')466 except NameError:467 send_messages(chat_id, f'Я тебя не понимаю. Не забудь про ввод цифрами')468 elif msg.lower() == "быки и коровы":469 bikTrue = True470 send_messages(chat_id,471 f'Цель игры - угадать число из 4 разных цифр по количеству общих цифр(коров) '472 f'и цифр, которые находятся на нужном месте(быков)')473 send_messages(chat_id, 'Введите четырехзначное число:')474 elif bikTrue and (len(msg) == 4 and msg.isdigit()):475 res = share(int(msg)) # принимаем пользовательское число476 normal = share(change(res)) # новый задуманный кортеж ...

Full Screen

Full Screen

main.py

Source:main.py Github

copy

Full Screen

1import os2import time3from datetime import date 4from datetime import datetime5def send_messages(phone_number, message):6 os.system('osascript send.scpt {} "{}"'.format(phone_number, message))7def get_today():8 return datetime.today().strftime('%A')9def get_hour():10 return datetime.now().strftime("%H:%M")11now = get_hour()12day = get_today()13phone = "8185578599"14send_messages(phone, "Hello, This is TheGamingCube's Bot")15send_messages(phone, "This will be a bot that notifies you when you have class!")16while True:17 time.sleep(60)18 now = get_hour()19 day = get_today()20 print("now =", now)21 print("today = ", day)22 if day == "Monday" or day == "Wednesday":23 if now == "7:55":24 send_messages(phone, "You Have Class in 5 Minutes, get ready to join")25 elif now == "7:59":26 send_messages(phone, "One Minute Till AP Bio!")27 send_messages(phone, "https://us02web.zoom.us/j/96182082414?pwd=eUc0SXpsS09ndmhhVWRzamtIcmRrQT09")28 elif now == "9:25":29 send_messages(phone, "You Have Class in 5 Minutes, get ready to join")30 elif now == "9:29":31 send_messages(phone, "One Minute Till AP Calculus BC!")32 send_messages(phone, "https://zoom.us/j/95979662195?pwd=d1RKRDFsaUR2ZUFMemowRVNGUTcxUT09")33 elif now == "10:55":34 send_messages(phone, "You Have Class in 5 Minutes, get ready to join")35 elif now == "10:59":36 send_messages(phone, "One Minute Till Digital Photo!")37 send_messages(phone, "https://meet.google.com/lookup/edzlr67rei?authuser=1&hs=179")38 elif now == "14:30":39 send_messages(phone,"Attendence Forms")40 send_messages(phone,"https://docs.google.com/forms/d/e/1FAIpQLScs81tH_SGnpBdnfYlYtWQqSzB-zYz15Azon99WuRO_kKyk7Q/viewform?entry.1828733646=Cody&entry.761704581=Lin&entry.1242183593=1")41 send_messages(phone,"https://docs.google.com/forms/d/e/1FAIpQLScs81tH_SGnpBdnfYlYtWQqSzB-zYz15Azon99WuRO_kKyk7Q/viewform?entry.1828733646=Cody&entry.761704581=Lin&entry.1242183593=2")42 send_messages(phone,"https://docs.google.com/forms/d/e/1FAIpQLScs81tH_SGnpBdnfYlYtWQqSzB-zYz15Azon99WuRO_kKyk7Q/viewform?entry.1828733646=Cody&entry.761704581=Lin&entry.1242183593=3")43 send_messages(phone,"https://docs.google.com/forms/d/e/1FAIpQLScs81tH_SGnpBdnfYlYtWQqSzB-zYz15Azon99WuRO_kKyk7Q/viewform?entry.1828733646=Cody&entry.761704581=Lin&entry.1242183593=7")44 if day == "Monday" and now == "14:59":45 send_messages(phone, "One Minute Till XC Google Meets")46 send_messages(phone, "https://meet.google.com/lookup/edzlr67rei?authuser=1&hs=179")47 elif day == "Tuesday" or day == "Thursday":48 if now == "7:55":49 send_messages(phone, "You Have Class in 5 Minutes, get ready to join")50 elif now == "7:59":51 send_messages(phone, "One Minute Till AP Gov!")52 send_messages(phone, "https://us02web.zoom.us/j/89078038414?pwd=M3VUc1pyU1FWQlI5QS9ySGFjZ0pjQT09")53 elif now == "9:25":54 send_messages(phone, "You Have Class in 5 Minutes, get ready to join")55 elif now == "9:29":56 send_messages(phone, "One Minute Till ERWC(English)!")57 send_messages(phone, "https://us02web.zoom.us/j/82412177292?pwd=UXpIWmVhKzJmb296WWt2eG1WV2s5Zz09")58 elif now == "14:30":59 send_messages(phone,"Attendence Forms")60 send_messages(phone,"https://docs.google.com/forms/d/e/1FAIpQLScs81tH_SGnpBdnfYlYtWQqSzB-zYz15Azon99WuRO_kKyk7Q/viewform?entry.1828733646=Cody&entry.761704581=Lin&entry.1242183593=4")61 send_messages(phone,"https://docs.google.com/forms/d/e/1FAIpQLScs81tH_SGnpBdnfYlYtWQqSzB-zYz15Azon99WuRO_kKyk7Q/viewform?entry.1828733646=Cody&entry.761704581=Lin&entry.1242183593=5")62 send_messages(phone,"https://docs.google.com/forms/d/e/1FAIpQLScs81tH_SGnpBdnfYlYtWQqSzB-zYz15Azon99WuRO_kKyk7Q/viewform?entry.1828733646=Cody&entry.761704581=Lin&entry.1242183593=7")63 64 elif day == "Friday":65 if now == "8:55":66 send_messages(phone, "If you would like to attend office hours find the class and time on here")67 send_messages(phone, "https://docs.google.com/document/d/1zWlMsYWrB7KzbIUgNECZ-hWzDCvJBQuUCTP6wPg1fKU/edit")68 send_messages(phone, "AP Bio - https://us02web.zoom.us/j/96343587368?pwd=WGpTTXFNSDRLcVVkSTN4bzRZQ1FmZz09")69 send_messages(phone, "AP Calc BC - https://zoom.us/j/95904304937?pwd=dGEwUnVrU1FObFZiUzBKV0lENTd1dz09")70 send_messages(phone, "Digital Photo does not have friday office hours")71 send_messages(phone, "AP Gov - https://us02web.zoom.us/j/84029102432?pwd=WGE5TE9jRndjRENQMWRQTndLYWJXUT09")72 send_messages(phone, "ERWC - https://us02web.zoom.us/j/82383516265?pwd=OFE4Z0ljZnltZDR1NkVuWGxlMWlUdz09")73 if now == "15:00":74 send_messages(phone,"https://docs.google.com/forms/d/e/1FAIpQLScs81tH_SGnpBdnfYlYtWQqSzB-zYz15Azon99WuRO_kKyk7Q/viewform?entry.1828733646=Cody&entry.761704581=Lin&entry.1242183593=1")75 send_messages(phone,"https://docs.google.com/forms/d/e/1FAIpQLScs81tH_SGnpBdnfYlYtWQqSzB-zYz15Azon99WuRO_kKyk7Q/viewform?entry.1828733646=Cody&entry.761704581=Lin&entry.1242183593=2")76 send_messages(phone,"https://docs.google.com/forms/d/e/1FAIpQLScs81tH_SGnpBdnfYlYtWQqSzB-zYz15Azon99WuRO_kKyk7Q/viewform?entry.1828733646=Cody&entry.761704581=Lin&entry.1242183593=3")77 send_messages(phone,"https://docs.google.com/forms/d/e/1FAIpQLScs81tH_SGnpBdnfYlYtWQqSzB-zYz15Azon99WuRO_kKyk7Q/viewform?entry.1828733646=Cody&entry.761704581=Lin&entry.1242183593=4")78 send_messages(phone,"https://docs.google.com/forms/d/e/1FAIpQLScs81tH_SGnpBdnfYlYtWQqSzB-zYz15Azon99WuRO_kKyk7Q/viewform?entry.1828733646=Cody&entry.761704581=Lin&entry.1242183593=5")79 send_messages(phone,"https://docs.google.com/forms/d/e/1FAIpQLScs81tH_SGnpBdnfYlYtWQqSzB-zYz15Azon99WuRO_kKyk7Q/viewform?entry.1828733646=Cody&entry.761704581=Lin&entry.1242183593=7")80 elif day == "Saturday":81 if now == "12:25":82 send_messages(phone, "You Have Class in 5 Minutes, get ready to join")83 elif now == "12:29":84 send_messages(phone, "One Minute Till CS 130 - Introduction to Algorithms (GCC)")85 send_messages(phone, "https://cccconfer.zoom.us/j/93266916651?pwd=enN3em1xMzRjbTlFRWpXMEN1aVRnZz09")86 87 else:88 if now == "12:00":...

Full Screen

Full Screen

test_send_messages.py

Source:test_send_messages.py Github

copy

Full Screen

...22 """23 Verify that send_messages returns nothing if no messages are passed.24 """25 sendgrid_backend = SendGridBackend(api_key="test")26 self.assertEqual(sendgrid_backend.send_messages(emails=[]), None)27 def test_sending(self):28 """Verify that send_messages returns sent count if message is sent."""29 sendgrid_backend = SendGridBackend(api_key="test")30 sendgrid_backend.sg.client = Mock()31 self.assertEqual(32 sendgrid_backend.send_messages(emails=[self.test_message]), 133 )34 def test_failing_silently(self):35 """Verify that send_messages can fail silently."""36 sendgrid_backend = SendGridBackend(api_key="test")37 sendgrid_backend.sg.client = Mock()38 http_error = HTTPError(url="", code=999, msg=None, hdrs=None, fp=None)39 sendgrid_backend.sg.client.mail.send.post = Mock(40 side_effect=http_error41 )42 self.assertFalse(sendgrid_backend.fail_silently)43 with self.assertRaises(HTTPError):44 sendgrid_backend.send_messages(emails=[self.test_message])45 sendgrid_backend.fail_silently = True46 self.assertEqual(47 sendgrid_backend.send_messages(emails=[self.test_message]), 0...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run localstack automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful