Commit 330def5f authored by init6's avatar init6

get them drugs

parent 4a5f513f
import requests
import json
API_KEY = "<enter_key>"
def check_covid(zip_code):
headers = {
'authority': 'www.cvs.com',
'sec-ch-ua': '"Chromium";v="88", "Google Chrome";v="88", ";Not A Brand";v="99"',
'accept': 'application/json',
'dnt': '1',
'x-distil-ajax': 'xebztatfusvxtdxdzzerd',
'sec-ch-ua-mobile': '?0',
'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.190 Safari/537.36',
'content-type': 'application/json',
'origin': 'https://www.cvs.com',
'sec-fetch-site': 'same-origin',
'sec-fetch-mode': 'cors',
'sec-fetch-dest': 'empty',
'referer': 'https://www.cvs.com/vaccine/intake/store/cvd-store-select/first-dose-select',
'accept-language': 'en-US,en;q=0.9',
}
data = {
"requestMetaData":{
"appName":"CVS_WEB",
"lineOfBusiness":"RETAIL",
"channelName":"WEB",
"deviceType":"DESKTOP",
"deviceToken":"7777",
"apiKey": API_KEY,
"source":"ICE_WEB",
"securityType":"apiKey",
"responseFormat":"JSON",
"type":"cn-dep"
},
"requestPayloadData":{
"selectedImmunization":["CVD"],
"distanceInMiles":75,
"imzData":[
{
"imzType":"CVD",
"ndc":["59267100002","59267100003","59676058015","80777027399"],
"allocationType":"1"
}
],
"searchCriteria":{
"addressLine":zip_code
}
}
}
res = requests.post('https://www.cvs.com/Services/ICEAGPV1/immunization/1.0.0/getIMZStores', headers=headers, data=json.dumps(data))
res_json = res.json()
if res_json['responseMetaData']['statusDesc'].lower() == 'success':
return res_json['responsePayloadData']
else:
return False
def run():
zip_codes = ['76102', '75025', '79007']
for zip_code in zip_codes:
available = check_covid(zip_code)
if available:
print('Location {} has dates available.\n'.format(zip_code))
print(json.dumps(available, indent=4, sort_keys=True))
if __name__ == '__main__':
run()
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment