Description
Description
When I try to submit to Codeforces, it receives wrong User-Agent error message and this submission failed.
[WARNING] You may use wrong User-Agent: 'online-judge-tools/11.1.1 (+https://github.com/online-judge-tools/oj)'
[FAILURE] submission failed
Error log
I have already signed into Codeforces using CUI-based login.
$ oj login https://codeforces.com/contest/1447/problem/A
[INFO] online-judge-tools 11.1.1 (+ online-judge-api-client 10.5.0)
[INFO] service recognized: CodeforcesService.from_url('https://codeforces.com/'): https://codeforces.com/contest/1447/problem/A
[NETWORK] GET: https://codeforces.com/enter
[NETWORK] 200 OK
[FAILURE] You are not signed in.
[INFO] Trying to open Chrome via WebDriver...
[ERROR] Message: 'chromedriver' executable needs to be in PATH. Please see https://sites.google.com/a/chromium.org/chromedriver/home
[INFO] Trying to open Firefox via WebDriver...
[ERROR] Message: 'geckodriver' executable needs to be in PATH.
[INFO] Trying to open Edge via WebDriver...
[ERROR] Message: 'MicrosoftWebDriver.exe' executable needs to be in PATH. Please download from http://go.microsoft.com/fwlink/?LinkId=619687
[INFO] Trying to open Internet Explorer via WebDriver...
[ERROR] Message: 'IEDriverServer.exe' executable needs to be in PATH. Please download from http://selenium-release.storage.googleapis.com/index.html and read up at https://github.com/SeleniumHQ/selenium/wiki/InternetExplorerDriver
[INFO] Trying to open Safari via WebDriver...
[ERROR] SafariDriver was not found; are you running Safari 10 or later? You can download Safari at https://developer.apple.com/safari/download/.
[INFO] Trying to open Opera via WebDriver...
[ERROR] Message: 'operadriver' executable needs to be in PATH. Please see https://sites.google.com/a/chromium.org/chromedriver/home
[ERROR] No WebDriver is available.
[HINT] Please install a WebDriver.
See https://www.selenium.dev/documentation/en/webdriver/driver_requirements/
Detailed instructions:
If you use Ubuntu:
1. Run $ sudo apt install chromium-chromedriver firefox-geckodriver
If you use Ubuntu under Windows Subsystem for Linux:
1. Make a symbolic link from cookie.jar in WSL to cookie.jar out of WSL. For example, run $ ln -s /mnt/c/Users/%USERNAME%/AppData/Local/online-judge-tools/online-judge-tools/cookie.jar /home/ubuntu/.local/share/online-judge-tools/cookie.jar
2. Use `oj login` outside of WSL
If you use Windows:
1. Install Chocolatey. See https://chocolatey.org/
2. Run > choco install selenium-all-drivers
[WARNING] Switch to use CUI-based login instead of Selenium
[NETWORK] GET: https://codeforces.com/enter
[NETWORK] 200 OK
Username: seiran
Password:
[NETWORK] POST: https://codeforces.com/enter
[NETWORK] redirected to: https://codeforces.com/
[NETWORK] 200 OK
[INFO] Welcome, seiran.
[NETWORK] GET: https://codeforces.com/enter
[NETWORK] 302 Found
[SUCCESS] You have already signed in.
[INFO] save cookie to: /home/hotaru/.local/share/online-judge-tools/cookie.jar
$ oj s submit.cpp
[INFO] online-judge-tools 11.1.1 (+ online-judge-api-client 10.5.0)
[INFO] read history from: /home/hotaru/.cache/online-judge-tools/download-history.jsonl
[INFO] found urls in history:
https://codeforces.com/contest/1447/problem/A
[INFO] guessed problem: https://codeforces.com/contest/1447/problem/A
[INFO] problem recognized: CodeforcesProblem.from_url('https://codeforces.com/contest/1447/problem/A'): https://codeforces.com/contest/1447/problem/A
[INFO] code (1239 byte):
** MY SOLUTION **
[INFO] load cookie from: /home/hotaru/.local/share/online-judge-tools/cookie.jar
[NETWORK] GET: https://codeforces.com/enter
[NETWORK] 302 Found
[INFO] You are logged in.
[NETWORK] GET: https://codeforces.com/contest/1447/problem/A
[NETWORK] 200 OK
[INFO] both GCC and Clang are available for C++ compiler
[INFO] use: GCC
[INFO] chosen language: 61 (GNU G++17 9.2.0 (64 bit, msys 2))
[INFO] sleep(3.00)
Are you sure? [y/N] y
[NETWORK] GET: https://codeforces.com/contest/1447/problem/A
[NETWORK] 200 OK
[NETWORK] POST: https://codeforces.com/contest/1447/problem/A
[NETWORK] 403 Forbidden
[ERROR] 403 Client Error: for url: https://codeforces.com/contest/1447/problem/A
Traceback (most recent call last):
File "/home/hotaru/.local/lib/python3.8/site-packages/onlinejudge/service/codeforces.py", line 389, in submit_code
resp.raise_for_status()
File "/home/hotaru/.local/lib/python3.8/site-packages/requests/models.py", line 943, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 403 Client Error: for url: https://codeforces.com/contest/1447/problem/A
[WARNING] You may use wrong User-Agent: 'online-judge-tools/11.1.1 (+https://github.com/online-judge-tools/oj)'
[FAILURE] submission failed
Environment
Ubuntu under Windows Subsystem for Linux
Windows
- エディション: Windows 10 Pro
- バージョン: 20H2
- OS ビルド: 19042.630
WSL
- WSL version: WSL2
- Linux distribution: Ubuntu 20.04.1 LTS
Python and oj
$ python3 --version
Python 3.8.5
$ oj --version
online-judge-tools 11.1.1 (+ online-judge-api-client 10.5.0)
Other notes
- Will you try to create a pull request?
- no