From 08e2b23e6282213027069c81e55c37a1cb8186ec Mon Sep 17 00:00:00 2001 From: Luis Mota Date: Sat, 19 Mar 2022 20:16:27 -0300 Subject: [PATCH 1/2] FIX: updated parameter _format values for /pdq_listing_details --- airbnb/api.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/airbnb/api.py b/airbnb/api.py index 3ea0daa..b98c5a0 100644 --- a/airbnb/api.py +++ b/airbnb/api.py @@ -6,6 +6,14 @@ import os import functools +""" +TODO Backlog + They've launched api/v3 (see on browser network analyser) + get_details is 400 (bad req) with _format param, there are others which work + Get more API keys and randomize, find limitations (fake accounts?) + +""" + API_URL = "https://api.airbnb.com/v2" API_KEY = "915pw2pnf4h1aiguhph5gc5b2" @@ -379,8 +387,10 @@ def get_homes(self, query=None, gps_lat=None, gps_lng=None, checkin=None, checko @randomizable def get_listing_details(self, listing_id): params = { - 'adults': '0', - '_format': 'for_native', + 'adults': '2', + #'_format' : 'for_web_dateless', + '_format': 'for_rooms_show', # most detailed format + #'_format': 'for_native', 'infants': '0', 'children': '0' } From 8dffa8eeed5eb10772645104fe3a847c6a7c108a Mon Sep 17 00:00:00 2001 From: Luis Mota Date: Sat, 19 Mar 2022 20:35:00 -0300 Subject: [PATCH 2/2] wishlists support --- airbnb/api.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/airbnb/api.py b/airbnb/api.py index b98c5a0..a71f09b 100644 --- a/airbnb/api.py +++ b/airbnb/api.py @@ -400,6 +400,33 @@ def get_listing_details(self, listing_id): return r.json() + @require_auth + def get_wishlist(self, wishlist_id): + """ + Get a wishlist's primary information + """ + r = self._session.get(API_URL + "/wishlists/" + wishlist_id) + r.raise_for_status() + + return r.json() + + @require_auth + def get_wishlist_listings(self, wishlist_id, offset=0, limit=100): + """ + Get a wishlist's listings + """ + params = { + 'wishlist_id':str(wishlist_id), + '_format': 'for_collaborator', + '_offset': str(offset), + '_limit': str(limit) + } + + r = self._session.get(API_URL + "/wishlisted_listings", params=params) + r.raise_for_status() + + return r.json() + if __name__ == "__main__": import doctest