Skip to content

Instantly share code, notes, and snippets.

@frantisekz
Created January 12, 2021 13:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save frantisekz/3e1796878e213ba6eaeeb6fd24600616 to your computer and use it in GitHub Desktop.
Save frantisekz/3e1796878e213ba6eaeeb6fd24600616 to your computer and use it in GitHub Desktop.
testdays_webapp_result_submitter
#!/usr/bin/python3
import re
import requests
# Use staging instance for testing, eg. https://testdays.stg.fedoraproject.org/events/90/enter_result/2767
# Use production instance for real use, eg. https://testdays.fedoraproject.org/events/90/enter_result/2767
result_url = "https://testdays.fedoraproject.org/events/2/enter_result/36"
username = "check"
# Fetch CSRF
s = requests.Session()
csrf = s.get(result_url)
csrf = re.findall(r'<input id="csrf_token" name="csrf_token" type="hidden" value="(.*)"', csrf.text)[0]
# Submit results
# Result can be one of ["PASSED", "FAILED", "INFO"]
data = {'comment': '', 'result': 'PASSED', 'col_1': '', 'username': username, 'bugs': '', 'csrf_token': csrf}
submit = s.post(result_url, data=data)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment