<jupyter_start><jupyter_text>Needs WorkHome Depot.com fronts with Akamai and they refuse bot traffic with an HTTP response like (yes, complete with the dangling ``)```Access DeniedAccess DeniedYou don't have permission to access "http://www.homedepot.com/mcc-cart/v2/info/storefulfillment?" on this server.Reference ...```In this past this did not use to be the case. A bare curl request would always return. Setting a real User Agent string doesn't bypass this, you need to send back real cookies.Therefore this code no longer functions as-is.<jupyter_code>import json, urllib
from twilio.rest import Client
# Get the Item ID from the end of the product page URL
# For example: https://www.homedepot.com/p/Forum-Novelties-Clown-Around-Town-Child-Costume-F62198-M/204447677
item_id = '204447677'

# Your Account Sid and Auth Token from twilio.com/console
account_sid = 'AC...'
auth_token = '...'
twilio_from_number = '+1585475....'
sms_destination = '+1585475....'

client = Client(account_sid, auth_token)
def getQtys(store='1861'):
    url = 'https://www.homedepot.com/mcc-cart/v2/info/storefulfillment?itemId=' + item_id + '&keyword=' + store

    raw_resp = urllib.request.urlopen(url).read()
    resp = json.loads(raw_resp.decode())

    qty_now = resp['storeFulfillment']['storeFulfillmentDetails']['primaryStore']['fulfillmentOptions']['buyOnlinePickupInStore']['inventory']['onHandQuantity']
    qty_maybe = resp['storeFulfillment']['storeFulfillmentDetails']['primaryStore']['fulfillmentOptions']['buyOnlinePickupInStore']['inventory']['expectedQuantityAvailable']
    
    return [qty_now, qty_maybe]
def sendSMS(msg):
    message = client.messages \
                .create(
                     body=msg,
                     from_=twilio_from_number,
                     to=sms_destination
                 )
# The store number is shown when you select your local store
# For example: San Jose (ge) #1861, or East Palo Alto #6603

# Palo Alto store
if getQtys('6603') != [0,0]:
    sendSMS('Clowns in stock @ EPA')

# San Jose default store
if getQtys() != [0,0]:
    sendSMS('Clowns in stock @ San Jose')<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.12191717077710564, 'fraction_numerical': 0.027454630060493253, 'mean_word_length': 4.070754716981132, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 2, 'lorem ipsum': 0, 'www.': 3, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '329905', 'license': 'MIT', 'n_tokens_mistral': 729, 'n_tokens_neox': 673, 'n_words': 184, 'path': 'Home Depot.ipynb', 'repo_name': 'vladionescu/stock-alerts', 'size': '2149'}