def setUp(self): self.key = os.getenv("BESTBUY_API_KEY") self.bbapi = BestBuyAPI(self.key)
#Will return T/F, checks to see if the product can be ordered online greyInStock = response_parsed['products'][0]['onlineAvailability'] colorInStock = response_parsed['products'][1]['onlineAvailability'] return greyInStock, colorInStock def main(): #Loop every 10 minutes to check, if they are in stock, shoot a text to my phone while True: grey, color = checkStock() if grey or color: twil_client.messages \ .create( body="Switches are in stock on BestBuy.com", messaging_service_sid=properties.twilio_msg_sid, to=properties.twilio_personal_number, from_=properties.twilio_msg_service_number ) print("Found one in stock!") else: print("No luck this time: " + datetime.datetime.now().strftime("%d-%m-%y %H:%M")) time.sleep(300) if __name__ == "__main__": twil_client = Client(properties.twilio_spi_key, properties.twilio_auth_token) bb = BestBuyAPI(properties.api_key) main()
def setUp(self): self.key = os.getenv("BESTBUY_API_KEY") # initialize both bestbuy products and categories api both APIs # are used arbitrarily to make general tests self.bbapi = BestBuyAPI(self.key)
def setUp(self): self.key = os.getenv("BESTBUY_API_KEY") self._api_name = "stores" self.bbapi = BestBuyAPI(self.key)
Notification().send(payload, 'pushover') if config.get('Alerts', 'webhook', fallback=None) is not None: Notification().send(payload, agent="webhook") if config.get('Alerts', 'pushBulletKey', fallback=None) is not None: Notification().send(payload, agent="pushbullet") if config.get('Alerts', 'smsNumber', fallback=None) is not None: Notification().send(payload, agent="sms") for store in items: product_ids = items[store].keys() if store.lower() == "bestbuy" and not disable_bestbuy: for sku in product_ids: bb = BestBuyAPI(config.get('APIKeys', 'BestBuyAPIKey')) product = bb.products.search_by_sku(sku=sku, format='json') if product['total'] >= 1: product_name = product['products'][0]['name'] url = product['products'][0]['url'] inStoreAvailability = product['products'][0][ 'inStoreAvailability'] onlineAvailability = product['products'][0][ 'onlineAvailability'] if product['products'][0]['onSale']: price = product['products'][0]['salePrice'] else: price = product['products'][0]['regularPrice'] if inStoreAvailability is False and onlineAvailability is False: continue if price <= items[store][sku][