Skip to content

Instantly share code, notes, and snippets.

@vlinhart
vlinhart / models.py
Last active August 7, 2020 12:54
expedia webhook cancel sync
class Booking(models.Model):
def get_booking_status_from_provider(self):
# this just calls GET for the itinerary_link from finished booking
if self.provider == PROVIDER_RAPID:
from roomstorm.rapid.feeds import ItineraryFeed
feed = ItineraryFeed(self.provider_data['itinerary_id'], self.meta_data['itinerary_link'], 'session')
return feed.retrieve_booking_data()
else:
raise NotImplementedError
{
"dataFormatVersion": "0.2.3",
"updatedAt": "2019-07-04T12:10:00.000Z",
"legalEntity": {
"name": "Roomstorm",
"address": {
"road": "Somewhere pretty",
"houseNumber": "123",
"city": "Horní Dolní",
"countryCode": "CS"
@vlinhart
vlinhart / main.py
Last active October 3, 2016 19:35
Simple micropython game for 2 players
import time
from time import sleep
import uos
from machine import Pin, PWM, Timer
from neopixel import NeoPixel
# http://pyladies.cz/v1/s016-micropython/index.html
# sudo screen /dev/ttyUSB0 115200
# http://docs.micropython.org/en/v1.8/esp8266/esp8266/tutorial/neopixel.html
//request
{
"start_date": "2015-12-01",
"end_date": "2015-12-02",
"room_guests": {
"adults": 2,
"children_ages": [
// or null
2,
4
@vlinhart
vlinhart / buy_endpoint.json
Last active April 30, 2017 01:16
/buy/ proposed api
// Request POST body - common
{
"seller_site": "http://localhost:8000/backend/v1/sites/28950",
"buyer_site": "http://localhost:8000/backend/v1/sites/1", // the SFO for example, we can't say on backend which site user wants
"start_date": "2015-12-01",
"end_date": "2015-12-02",
"room_guests": {
"room_data": {
"price": 250,
@vlinhart
vlinhart / rooms.json
Last active April 30, 2017 01:17
/rooms/ example
// POST request body
{
"site": 'http://localhost:8000/backend/v1/sites/28950',
"start_date": '2015-12-01',
"end_date": '2015-12-02',
"room_guests": {
"adults": 2,
"children_ages": [ // or null
2,
4