Resy exposes a number of API endpoints for making reservations,
these can be investigated by taking a look at the api.resy.com
calls from the network tab. We can have some fun making automated
calls to those endpoints right when reservations become available
Primary dependencies are pydantic and requests. pydantic is used for serializing/deserializing requests/responses from Resy.
This project's dependencies are managed by poetry, so (assuming you have poetry installed) you can just install as easily as
poetry install
.
The primary pieces of configuration for local execution are
defined in the ResyConfig
and TimedReservationRequest
pydantic models in resy_bot/models.py
.
ResyConfig
specifies credentials for personal Resy accounts.
Users should create a credentials.json
file formatted as:
{
"api_key": "<api-key>",
"token": "<api-token>",
"payment_method_id": <payment-method>,
"email": "<email>",
"password": "<password>"
}
These values can be found in requests made in the Network tab.
api_key
can be found in the request headers under the keyAuthorization
in the formatResyAPI api_key="<api-key>"
token
can be found in the request headers under the keyX-Resy-Auth-Token
payment_method_id
can be found in the request body to the endpoint/3/book
In order to make a reservation right as it drops, a JSON
TimedReservationRequest
must be created, see the following example
JSON:
{
"reservation_request": {
"party_size": 4,
"venue_id": 12345,
"window_hours": 1,
"prefer_early": false,
"ideal_date": "2023-03-30",
"days_in_advance": 14,
"ideal_hour": 19,
"ideal_minute": 30,
"preferred_type": "Dining Room"
},
"expected_drop_hour": "10",
"expected_drop_minute": "0"
}
These fields are mostly determined by the user:
party_size
is the number of members in the partyvenue_id
is another field taken from communication in the Network tab. This can be found as a URL param in requests to the/2/config
endpoint when navigating to the desired restaurant pagewindow_hours
is the number of hours before & after the ideal hour/minute you are interested inprefer_early
determines whether the earlier slot is selected when 2 time slots equidistant fom ideal hour/minuteideal_date
is the date to search. This should not be provided ifdays_in_advance
is useddays_in_advance
is the number of days from now that the reservation becomes available. This should not be provided ifideal_date
is usedideal_hour
defines the hour field of the ideal timeslotideal_minute
defines the minute field of the ideal timeslotpreferred_type
is an optional field defining the type of seating desired. If provided, Resy-Bot will only search for that seating typeexpected_drop_hour
defines the hour field to of datetime to start searching for slotsexpected_drop_minute
defines the minute field to of datetime to start searching for slots
This application can be run from the command line. To do so, the command should be formatted as
poetry run python main.py <path/to/credentials.json> <path/to/reservation/request.json>
From here, the application will wait until the time specified by
expected_drop_hour
and expected_drop_minute
to begin searching
for available timeslots.