Skip to content

Instantly share code, notes, and snippets.

@dustyfresh
Last active September 14, 2017 18:57
Show Gist options
  • Select an option

  • Save dustyfresh/5b4297b49be02b572196fb4521476fc5 to your computer and use it in GitHub Desktop.

Select an option

Save dustyfresh/5b4297b49be02b572196fb4521476fc5 to your computer and use it in GitHub Desktop.
That one time I tried to hack pasta from Olive Garden's PastaPass.com site
#!/usr/bin/env python
'''
Script to log the PastaPass.com drop
'''
import json
import requests
import time
import datetime
import sys
log = 'pasta.log'
def logger(msg):
with open(log, 'a') as logfile:
logfile.write('{} - {}\n'.format(datetime.datetime.fromtimestamp(time.time()).strftime('%Y-%m-%d %H:%M:%S'), msg))
while True:
headers = { 'user-agent': 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:55.0) Gecko/20100101 Firefox/55.0' }
time.sleep(1)
api = json.loads(requests.get('https://api.pastapass.com/home/available', headers=headers).text)
logger(api)
print('{} - {}\n'.format(datetime.datetime.fromtimestamp(time.time()).strftime('%Y-%m-%d %H:%M:%S'), api))
if api['pastaPassSoldOut'] is True and api['pastaPassportSoldOut'] is True:
sys.exit(1)

Drop

2017-09-14 17:59:59 - {u'available': False, u'pastaPassSoldOut': False, u'saleStart': u'2017-09-14 14:00:00', u'success': True, u'pastaPassportSoldOut': False}
2017-09-14 18:00:01 - {u'available': True, u'pastaPassSoldOut': False, u'saleStart': u'2017-09-14 14:00:00', u'success': True, u'pastaPassportSoldOut': False}

Pasta passport sellout

2017-09-14 18:02:58 - {u'available': True, u'pastaPassSoldOut': False, u'saleStart': u'2017-09-14 14:00:00', u'success': True, u'pastaPassportSoldOut': False}

Pasta pass sellout

2017-09-14 18:30:00 - {u'available': False, u'pastaPassSoldOut': True, u'saleStart': u'2017-09-14 14:00:00', u'success': True, u'pastaPassportSoldOut': True}
#!/usr/bin/env python
'''
PastaPass.com button clicking bot.
Clicks the buy button on the PastaPassport button to
get in queue as fast as possible.
- DustyFresh
'''
import json
import requests
import time
from splinter import Browser
import sys
class Pasta():
def start(self):
self.browser = Browser()
url = 'https://www.pastapass.com/'
self.browser.visit(url)
time.sleep(1)
self.browser.click_link_by_id('ppp')
def exit(self):
self.browser.quit()
pasta = Pasta()
while True:
headers = { 'user-agent': 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:55.0) Gecko/20100101 Firefox/55.0' }
time.sleep(1)
api = json.loads(requests.get('https://api.pastapass.com/home/available', headers=headers).text)
if api['available'] is not False and api['pastaPassSoldOut'] is not True:
pasta.start()
sys.exit(1)
else:
print('not yet available :(')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment