You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
542 B
20 lines
542 B
#!/usr/bin/env python3
|
|
|
|
import requests
|
|
import sys
|
|
import data1
|
|
|
|
baseurl = "http://127.0.0.1:5000"
|
|
session = requests.session()
|
|
|
|
with session.post(baseurl + "/admin/login", {'username': 'admin', 'password': 'admin'}) as req:
|
|
if req.status_code != 200:
|
|
print("Auth Failed")
|
|
sys.exit(1)
|
|
|
|
for x in data1.data:
|
|
print(f"POSTing {baseurl + '/chemical/create'} for {x}...")
|
|
req = session.post(baseurl + "/chemical/create", x)
|
|
if req.status_code != 200:
|
|
print(f"Request Failed for {x}")
|
|
print("Complete.")
|