Skip to content

Instantly share code, notes, and snippets.

@sriteja777
Last active August 21, 2023 18:10
Show Gist options
  • Save sriteja777/5bd0a20e98c578fa96f298b8193177f6 to your computer and use it in GitHub Desktop.
Save sriteja777/5bd0a20e98c578fa96f298b8193177f6 to your computer and use it in GitHub Desktop.
Script to get all institutes eligible under ICICI LTF Sapphiro Alumni Offer
import subprocess
import json
#Increase this number for searching for more institutes
maxNumber = 119
numbers = []
for i in range(1, maxNumber):
# Convert the number to a string and pad with zeros
number_str = str(i).zfill(4)
numbers.append(number_str)
command= "curl -s 'https://lapps-in21.leadsquared.com/executebylapptoken?name=da_46725_b19b105f&stage=Live&xapikey=10bd548a582140acbbebeb711cd8ea32&type=InstituteCode' \
-H 'authority: lapps-in21.leadsquared.com' \
-H 'accept: */*' \
-H 'accept-language: en-GB,en-US;q=0.9,en;q=0.8' \
-H 'content-type: application/json' \
-H 'origin: https://campaigns.icicibank.com' \
-H 'sec-ch-ua: \"Not.A/Brand\";v=\"8\", \"Chromium\";v=\"114\", \"Google Chrome\";v=\"114\"' \
-H 'sec-ch-ua-mobile: ?0' \
-H 'sec-ch-ua-platform: \"macOS\"' \
-H 'sec-fetch-dest: empty' \
-H 'sec-fetch-mode: cors' \
-H 'sec-fetch-site: cross-site' \
-H 'user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36' \
--data-raw '{\"instituteCode\":\"instnnnn\"}' \
--compressed"
institutes = []
for number in numbers:
new_command = command.replace("instnnnn", "inst"+number)
output = subprocess.check_output(new_command, shell=True)
output = output.decode("utf-8")
js = json.loads(output)
try:
institutes.append({"number": number, "displayName": js["message"]["Data"][0]["Display_Name"]})
except Exception as e:
print("error in fetching name for ", number, js)
for institute in institutes:
print(institute["number"], ": ", institute["displayName"])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment