Created
March 21, 2023 14:34
-
-
Save Ademking/fe10d46b99b5047b07763b75a4695657 to your computer and use it in GitHub Desktop.
Get list of technologies and materials
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
def getTechnologies(): | |
url = "https://smartquote-server.fathommfg.com/api/technologies/" | |
payload={} | |
headers = { | |
'authority': 'smartquote-server.fathommfg.com', | |
'accept': 'application/json, text/plain, */*', | |
'accept-language': 'en-US,en;q=0.9,fr-FR;q=0.8,fr;q=0.7', | |
'cache-control': 'no-cache', | |
'origin': 'https://smartquote.fathommfg.com', | |
'pragma': 'no-cache', | |
'referer': 'https://smartquote.fathommfg.com/', | |
'sec-ch-ua': '"Google Chrome";v="111", "Not(A:Brand";v="8", "Chromium";v="111"', | |
'sec-ch-ua-mobile': '?0', | |
'sec-ch-ua-platform': '"Windows"', | |
'sec-fetch-dest': 'empty', | |
'sec-fetch-mode': 'cors', | |
'sec-fetch-site': 'same-site', | |
'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/111.0.0.0 Safari/537.36' | |
} | |
response = requests.request("GET", url, headers=headers, data=payload) | |
response = response.json() | |
return response | |
def techMaterials(technologies, tech_name): | |
mydata = [] | |
for tech in technologies: | |
if technologies[tech]['title'] == tech_name: | |
materials = technologies[tech]['materials'] | |
for m in materials: | |
# push to array | |
mydata.append(materials[m]['title']) | |
return mydata | |
techs = getTechnologies() | |
m = techMaterials(techs, 'FDM') | |
print(m) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment