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

2 years ago
2 years ago
  1. #!/usr/bin/env python3
  2. import requests
  3. import sys
  4. import data1
  5. baseurl = "http://127.0.0.1:5000"
  6. session = requests.session()
  7. with session.post(baseurl + "/admin/login", {'username': 'admin', 'password': 'admin'}) as req:
  8. if req.status_code != 200:
  9. print("Auth Failed")
  10. sys.exit(1)
  11. for x in data1.data:
  12. print(f"POSTing {baseurl + '/chemical/create'} for {x}...")
  13. req = session.post(baseurl + "/chemical/create", x)
  14. if req.status_code != 200:
  15. print(f"Request Failed for {x}")
  16. print("Complete.")