diff options
author | Karl Lorey <git@karllorey.com> | 2022-06-23 17:19:30 +0200 |
---|---|---|
committer | Karl Lorey <git@karllorey.com> | 2022-06-23 17:19:30 +0200 |
commit | d08a69e478582ebd2be5ac3ff7c83591ef86bf8c (patch) | |
tree | 1f3e4f493ed7e572572b803d092cd8ede0c349d6 | |
parent | 3d885a53c4c97ee92a34296754f90c3fe3b404e6 (diff) |
Fix example formatting
-rw-r--r-- | examples/quotes_to_scrape.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/examples/quotes_to_scrape.py b/examples/quotes_to_scrape.py index 3020009..06954a7 100644 --- a/examples/quotes_to_scrape.py +++ b/examples/quotes_to_scrape.py @@ -12,26 +12,26 @@ def main(): """ # fetch the page to train - einstein_url = 'http://quotes.toscrape.com/author/Albert-Einstein/' + einstein_url = "http://quotes.toscrape.com/author/Albert-Einstein/" resp = requests.get(einstein_url) assert resp.status_code == 200 # create a sample for Albert Einstein training_set = TrainingSet() page = Page(resp.content) - sample = Sample(page, {'name': 'Albert Einstein', 'born': 'March 14, 1879'}) + sample = Sample(page, {"name": "Albert Einstein", "born": "March 14, 1879"}) training_set.add_sample(sample) # train the scraper with the created training set scraper = train_scraper(training_set) # scrape another page - resp = requests.get('http://quotes.toscrape.com/author/J-K-Rowling') + resp = requests.get("http://quotes.toscrape.com/author/J-K-Rowling") result = scraper.get(Page(resp.content)) print(result) # returns {'name': 'J.K. Rowling', 'born': 'July 31, 1965'} -if __name__ == '__main__': +if __name__ == "__main__": logging.basicConfig(level=logging.INFO) main() |