digital-engineering / airbnb-scraper

Airbnb Scraper: Advanced Airbnb Search using Scrapy
GNU General Public License v3.0
192 stars 66 forks source link

Error for flexible date requests #10

Closed essentialols closed 3 years ago

essentialols commented 3 years ago

When entering a flexible data like +-1 or +1 or -1, I get the error

Traceback (most recent call last): File "/usr/local/lib/python3.9/site-packages/scrapy/core/engine.py", line 129, in _next_request request = next(slot.start_requests) File "/Users/ingmarsturm/git/airbnb-scraper/deepbnb/spiders/airbnb.py", line 128, in start_requests yield from self.__explore_search.perform_checkin_start_requests( File "/Users/ingmarsturm/git/airbnb-scraper/deepbnb/api/ExploreSearch.py", line 133, in perform_checkin_start_requests checkin_start_date, checkin_range = self._build_date_range(self.__checkin, checkin_range_spec) File "/Users/ingmarsturm/git/airbnb-scraper/deepbnb/api/ExploreSearch.py", line 144, in _build_date_range base_date = date.fromisoformat(iso_date) ValueError: Invalid isoformat string: '2021-06-15+1-1'

According to the datetime manual, this seems to be the expected behavior:

https://docs.python.org/3/library/datetime.html

classmethod date.fromisoformat(date_string)
Return a date corresponding to a date_string given in the format YYYY-MM-DD:
datetime.date(2019, 12, 4)
This is the inverse of date.isoformat(). It only supports the format YYYY-MM-DD.
digitalengineering commented 3 years ago

Hello @essentialols, I've found an issue with the code and have fixed it. I believe ranged queries should work now. Please check and let me know if there are any issues.