Skip to content

A Smart, Automatic, Fast and Lightweight Web Scraper for Python

refactor: use json.dump and json.load (indirect IO interaction) rather

cthulhu-irlce087eb78bee
diff --git a/autoscraper/auto_scraper.py b/autoscraper/auto_scraper.py
index 380a147..15ea647 100644
--- a/autoscraper/auto_scraper.py
+++ b/autoscraper/auto_scraper.py
@@ -17,11 +17,11 @@ class AutoScraper(object):
def save(self, file_path):
with open(file_path, 'w') as f:
- f.write(json.dumps(self.stack_list))
+ json.dump(self.stack_list, f)
def load(self, file_path):
with open(file_path, 'r') as f:
- self.stack_list = json.loads(f.read())
+ self.stack_list = json.load(f)
@staticmethod
def _get_soup(url=None, html=None, request_args=None):