Created
January 12, 2021 13:47
-
-
Save frantisekz/3e1796878e213ba6eaeeb6fd24600616 to your computer and use it in GitHub Desktop.
testdays_webapp_result_submitter
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
#!/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