Closed as6325400 closed 6 months ago
I attempted to upload the code via the API but received a 401 response.
I have added roles for API reader and API writer
import requests import json url = 'https://pgds.csie.io/api/v4/contests/HW03/submissions' data = { "problem_id": "careful_hero", "language_id": "c", "team_id": "3", "time": "2024-03-09T15:11:57.344+08:00", "files": [ { "data": "#include<stdio.h>; int main(){printf(\"dwadwadad\");}" } ] } json_data = json.dumps(data) response = requests.post(url, data=json_data, headers={'Content-Type': 'application/json'}) print(response.status_code) print(response.text)
I tried to test whether the upload was successful with this piece of code, but I received a 401 response. Can you help me identify what I did wrong
Please use slack or our mailing lists to ask questions, see https://www.domjudge.org/development, this is meant for bug reports, feature requests etc.
The file contents should be base64 encoded IIRC.
I attempted to upload the code via the API but received a 401 response.
I have added roles for API reader and API writer
I tried to test whether the upload was successful with this piece of code, but I received a 401 response. Can you help me identify what I did wrong