Skip to content

Commit

Permalink
Create missing directory when scraping
Browse files Browse the repository at this point in the history
  • Loading branch information
svetter committed Aug 26, 2024
1 parent b85a6f4 commit b04b137
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions scrape.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,9 @@

sep = ','

# Make sure directory exists
os.makedirs(os.path.dirname(results_filepath), exist_ok=True)

with open(results_filepath, 'w', encoding='UTF-8', newline='\n') as f:
f.write(sep.join(["Check-in date", "Check-out date", "Room description", "Room capacity", "Meals", "Price", "Number available", "felix-id", "package-id", "room-id", "name-param", "Scrape date"]) + '\n')

Expand Down

0 comments on commit b04b137

Please sign in to comment.