3 ms·
This just seems like a combination of choosing the wrong abstraction and applying the DRY principle in a way that doesn't actually lead to less or clearer code.
by contravariant 9y ago
This just seems like a combination of choosing the wrong abstraction and applying the DRY principle in a way that doesn't actually lead to less or clearer code.
In this case almost none of the lines contain any superfluous information. At best you could try to simplify things slightly by writing it as follows:
class ChaseScraper:
def __init__(self, username, password):
self.credentials = {'username': username,
'password': password }
def scrape(self):
session = requests.Session()
sessions.get('https://chase.com/rest/login.aspx', data = credentials)
sessions.get('https://chase.com/rest/download_current_statement.aspx')
class CitibankScraper:
def __init__(self, username, password):
self.credentials = {'user': username,
'pass': password }
def scrape(self):
session = requests.Session()
sessions.get('https://citibank.com/cgi-bin/login.pl', data = credentials)
sessions.get('https://citibank.com/cgi-bin/download-stmt.pl')
- deleted 9y ago[deleted]