From a969a7634eb256b588bfd948100642e893516b9d Mon Sep 17 00:00:00 2001 From: Catalina Syddall Date: Fri, 2 Aug 2019 17:56:47 -0300 Subject: [PATCH] changing notification channel --- data_scraper/cboe.py | 53 +++++++++++++++++++---------------- data_scraper/notifications.py | 12 ++++---- 2 files changed, 36 insertions(+), 29 deletions(-) diff --git a/data_scraper/cboe.py b/data_scraper/cboe.py index 116caa9..fe4611a 100644 --- a/data_scraper/cboe.py +++ b/data_scraper/cboe.py @@ -6,10 +6,8 @@ from itertools import groupby from bs4 import BeautifulSoup import requests -import pandas as pd +import pandas as pd import tenacity -import time -import csv from . import utils, validation from .notifications import send_report @@ -44,7 +42,7 @@ def fetch_data(symbols=None): for symbol in symbols: form_data["ctl00$ContentTop$C005$txtTicker"] = symbol - + try: assert symbol in valid_symbols response = requests.post(url, @@ -59,20 +57,23 @@ def fetch_data(symbols=None): if symbol_data == "" or symbol_data.startswith(" 0: - msg_fail = "⚠️️ Failed to {} {}: {}".format(op, _symbol_str(len(failed)), - ", ".join(failed)) + msg_fail = "⚠️️ Failed to {} {}: {}".format(op, + _symbol_str(len(failed)), + ", ".join(failed)) else: msg_fail = "No symbols fail to scrape! 🤩" - - msg= msg_success + '\n' + msg_fail + + msg = msg_success + '\n' + msg_fail slack_notification(msg, scraper, status=Status.Warning) + def _symbol_str(count): return str(count) + " symbol" if count == 1 else str(count) + " symbols"