oj-api login-service https://codeforces.com | jq .result
INFO:root:online-judge-api-client 10.2.1
INFO:root:sleep 1.000000 sec
INFO:onlinejudge._implementation.logging:[-] unknown problem: https://codeforces.com
INFO:onlinejudge._implementation.logging:[-] unknown contest: https://codeforces.com
INFO:onlinejudge._implementation.logging:[x] service recognized: CodeforcesService.from_url('https://codeforces.com/'): https://codeforces.com
INFO:onlinejudge._implementation.logging:[x] load cookie from: /home/whiteknife/.local/share/online-judge-tools/cookie.jar
INFO:onlinejudge._implementation.logging:[x] GET: https://codeforces.com/enter
INFO:onlinejudge._implementation.logging:[x] 200 OK
INFO:onlinejudge._implementation.logging:[x] POST: https://codeforces.com/enter
INFO:onlinejudge._implementation.logging:[x] 200 OK
INFO:onlinejudge._implementation.logging:[-] Invalid handle or password.
ERROR:root:Invalid handle or password.
Traceback (most recent call last):
File "/home/whiteknife/.local/lib/python3.8/site-packages/onlinejudge_api/main.py", line 279, in main
result = login_service.main(service, username=parsed.username, password=parsed.password, check_only=parsed.check, session=session)
File "/home/whiteknife/.local/lib/python3.8/site-packages/onlinejudge_api/login_service.py", line 40, in main
service.login(get_credentials=get_credentials, session=session)
File "/home/whiteknife/.local/lib/python3.8/site-packages/onlinejudge/service/codeforces.py", line 55, in login
raise LoginError('Invalid handle or password.')
onlinejudge.type.LoginError: Invalid handle or password.
null
$BROWSER
envvar, e.g. $ BROWSER=firefox oj submit ...
or export BROWSER=firefox
in your .bashrc
. We use Python's webbrowser
module and the document is https://docs.python.org/3/library/webbrowser.html#:~:text=If%20the%20environment%20variable,the%20platform%20defaults.
oj-api login-service https://codeforces.com | jq .result
INFO:root:online-judge-api-client 10.2.1
INFO:root:sleep 1.000000 sec
INFO:onlinejudge._implementation.logging:[-] unknown problem: https://codeforces.com
INFO:onlinejudge._implementation.logging:[-] unknown contest: https://codeforces.com
INFO:onlinejudge._implementation.logging:[x] service recognized: CodeforcesService.from_url('https://codeforces.com/'): https://codeforces.com
INFO:onlinejudge._implementation.logging:[x] load cookie from: /home/whiteknife/.local/share/online-judge-tools/cookie.jar
INFO:onlinejudge._implementation.logging:[x] GET: https://codeforces.com/enter
INFO:onlinejudge._implementation.logging:[x] redirected: https://codeforces.com/profile/rds__98
INFO:onlinejudge._implementation.logging:[x] 200 OK
INFO:onlinejudge._implementation.logging:[*] You have already signed in.
INFO:onlinejudge._implementation.logging:[x] save cookie to: /home/whiteknife/.local/share/online-judge-tools/cookie.jar
{
"loggedIn": true
}
competitive/Cpp/output on master [!?] via 🅒 base took 3s
➜ oj-api submit-code https://atcoder.jp/contests/abc173/tasks/abc173_c --file main.cpp --language 3023 | jq .result
INFO:root:online-judge-api-client 10.2.1
INFO:root:sleep 1.000000 sec
INFO:onlinejudge._implementation.logging:[x] problem recognized: AtCoderProblem.from_url('https://atcoder.jp/contests/abc173/tasks/abc173_c'): https://atcoder.jp/contests/abc173/tasks/abc173_c
INFO:onlinejudge._implementation.logging:[x] contest recognized: <onlinejudge.service.atcoder.AtCoderContest object at 0x7f9b6228f970>: https://atcoder.jp/contests/abc173/tasks/abc173_c
INFO:onlinejudge._implementation.logging:[x] service recognized: AtCoderService.from_url('https://atcoder.jp/'): https://atcoder.jp/contests/abc173/tasks/abc173_c
INFO:onlinejudge._implementation.logging:[x] load cookie from: /home/whiteknife/.local/share/online-judge-tools/cookie.jar
INFO:onlinejudge._implementation.logging:[x] GET: https://atcoder.jp/contests/abc173/tasks/abc173_c
INFO:onlinejudge._implementation.logging:[x] 200 OK
ERROR:onlinejudge._implementation.logging:[ERROR] not logged in
ERROR:root:login required
Traceback (most recent call last):
File "/home/whiteknife/.local/lib/python3.8/site-packages/onlinejudge_api/main.py", line 285, in main
result = submit_code.main(problem, file=parsed.file, language_id=parsed.language, session=session)
File "/home/whiteknife/.local/lib/python3.8/site-packages/onlinejudge_api/submit_code.py", line 31, in main
submission = problem.submit_code(code, language_id=language_id, filename=str(file), session=session)
File "/home/whiteknife/.local/lib/python3.8/site-packages/onlinejudge/service/atcoder.py", line 884, in submit_code
assert language_id in [language.id for language in self.get_available_languages(session=session)]
File "/home/whiteknife/.local/lib/python3.8/site-packages/onlinejudge/service/atcoder.py", line 874, in get_available_languages
raise NotLoggedInError
onlinejudge.type.NotLoggedInError: login required
null
env
command (https://man7.org/linux/man-pages/man1/env.1.html) or the standard feature of your shell (https://man7.org/linux/man-pages/man1/bash.1.html#SIMPLE_COMMAND_EXPANSION)
oj-api login-service https://codeforces.com
logs in to Codeforces and oj-api submit-code https://atcoder.jp/contests/abc173/tasks/abc173_c
submits to AtCoder. AtCoder is not Codeforces, so you need to login AtCoder.
oj-api
command is a utility for developers. If you are just a competitor, please use a wrapper for end-users, e.g. oj
command https://github.com/online-judge-tools/oj
submission failed
[x] both GCC and Clang are available for C++ compiler
[x] use: GCC
[*] chosen language: 61 (GNU G++17 9.2.0 (64 bit, msys 2))
[!] the problem "https://codeforces.com/problemset/problem/1375/D" is specified to submit, but no samples were downloaded in this directory. this may be mis-operation
[x] sleep(3.00)
Are you sure? Please type "D" D
[-] submission failed
submission failed
didn't happen on my environment. I guess that your failure may be affected by online-judge-tools/api-client#73 and removing the cookie (the path is printed in the log output) and re-login may solve the issue.
oj-template
command in https://github.com/online-judge-tools/template-generator for this purpose. This command can generate a template of the test case generator of a given problem. Please try this!
std::
がつくように変更されていますが,何か理由があるのでしょうか.data["config"]["using_namespace_std"]
のオプションでstd::
の有無のスタイルを切り替えられること自体は(どちらがdefaultかはさておき)いい仕様だったように思うのですが.
Hi, Im unable to login to codeforces using oj command
oj login https://codeforces.com ─╯
[INFO] online-judge-tools 11.5.1 (+ online-judge-api-client 10.10.0)
[NETWORK] GET: https://codeforces.com/enter
[NETWORK] 200 OK
[FAILURE] You are not signed in.
[ERROR] Selenium is not installed. Please run $ pip3 install selenium
[WARNING] Switch to use CUI-based login instead of Selenium
[NETWORK] GET: https://codeforces.com/enter
[NETWORK] 200 OK
Username: testKJ2
Password:
[ERROR]
Traceback (most recent call last):
File "/Users/vibhorabrol/venv/academy-env/lib/python3.9/site-packages/onlinejudge_command/subcommand/login.py", line 195, in run
login_with_password(service, username=args.username, password=args.password, session=session)
File "/Users/vibhorabrol/venv/academy-env/lib/python3.9/site-packages/onlinejudge_command/subcommand/login.py", line 49, in login_with_password
service.login(get_credentials=get_credentials, session=session)
File "/Users/vibhorabrol/venv/academy-env/lib/python3.9/site-packages/onlinejudge/service/codeforces.py", line 46, in login
form = utils.FormSender(form, url=resp.url)
File "/Users/vibhorabrol/venv/academy-env/lib/python3.9/site-packages/onlinejudge/_implementation/utils.py", line 77, in init
assert isinstance(form, bs4.Tag)
AssertionError
[INFO] save cookie to: /Users/vibhorabrol/Library/Application Support/online-judge-tools/cookie.jar