Open nalinabrol opened 3 years ago
Sorry, I couldn't reproduce this issue. Does this issue persist?
Same issue, without selenium reproduced in docker
docker run -it --rm ubuntu /bin/bash
apt update
apt install python3 python3-pip
pip3 install online-judge-tools
oj login https://codeforces.com/
[INFO] GET: https://pypi.org/pypi/online-judge-tools/json
[INFO] 200 OK
[WARNING] failed to load the cache in update checking: 'online-judge-api-client'
[INFO] GET: https://pypi.org/pypi/online-judge-api-client/json
[INFO] 200 OK
[INFO] online-judge-tools 11.5.1 (+ online-judge-api-client 10.10.1)
[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: Cro-Marmot
Password:
[ERROR]
Traceback (most recent call last):
File "/usr/local/lib/python3.10/dist-packages/onlinejudge_command/subcommand/login.py", line 195, in run
login_with_password(service, username=args.username, password=args.password, session=session)
File "/usr/local/lib/python3.10/dist-packages/onlinejudge_command/subcommand/login.py", line 49, in login_with_password
service.login(get_credentials=get_credentials, session=session)
File "/usr/local/lib/python3.10/dist-packages/onlinejudge/service/codeforces.py", line 46, in login
form = utils.FormSender(form, url=resp.url)
File "/usr/local/lib/python3.10/dist-packages/onlinejudge/_implementation/utils.py", line 80, in __init__
assert isinstance(form, bs4.Tag)
AssertionError
[INFO] save cookie to: /root/.local/share/online-judge-tools/cookie.jar
env:
docker image ls
REPOSITORY TAG IMAGE ID CREATED SIZE
ubuntu latest 2dc39ba059dc 3 months ago 77.8MB
docker inspect ubuntu:latest
[
{
"Id": "sha256:2dc39ba059dcd42ade30aae30147b5692777ba9ff0779a62ad93a74de02e3e1f",
"RepoTags": [
"ubuntu:latest"
],
"RepoDigests": [
"ubuntu@sha256:20fa2d7bb4de7723f542be5923b06c4d704370f0390e4ae9e1c833c8785644c1"
],
"Parent": "",
"Comment": "",
"Created": "2022-09-01T23:46:35.375057619Z",
"Container": "b0df58d0a952d2cb3b35163ac557fe1886c0fe5cf73a82a16491a22089aadb8c",
"ContainerConfig": {
"Hostname": "b0df58d0a952",
"Domainname": "",
"User": "",
"AttachStdin": false,
"AttachStdout": false,
"AttachStderr": false,
"Tty": false,
"OpenStdin": false,
"StdinOnce": false,
"Env": [
"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
],
"Cmd": [
"/bin/sh",
"-c",
"#(nop) ",
"CMD [\"bash\"]"
],
"Image": "sha256:1f88c721b49061df8bcee6398193b3642df4f089f9343e138302473c3d58fc06",
"Volumes": null,
"WorkingDir": "",
"Entrypoint": null,
"OnBuild": null,
"Labels": {}
},
"DockerVersion": "20.10.12",
"Author": "",
"Config": {
"Hostname": "",
"Domainname": "",
"User": "",
"AttachStdin": false,
"AttachStdout": false,
"AttachStderr": false,
"Tty": false,
"OpenStdin": false,
"StdinOnce": false,
"Env": [
"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
],
"Cmd": [
"bash"
],
"Image": "sha256:1f88c721b49061df8bcee6398193b3642df4f089f9343e138302473c3d58fc06",
"Volumes": null,
"WorkingDir": "",
"Entrypoint": null,
"OnBuild": null,
"Labels": null
},
"Architecture": "amd64",
"Os": "linux",
"Size": 77834333,
"VirtualSize": 77834333,
"GraphDriver": {
"Data": {
"MergedDir": "/data/docker/overlay2/ace09cb7a1fa5c4bae12423ea2f20c2e6a15cf69cec08bf0028379df3083ed04/merged",
"UpperDir": "/data/docker/overlay2/ace09cb7a1fa5c4bae12423ea2f20c2e6a15cf69cec08bf0028379df3083ed04/diff",
"WorkDir": "/data/docker/overlay2/ace09cb7a1fa5c4bae12423ea2f20c2e6a15cf69cec08bf0028379df3083ed04/work"
},
"Name": "overlay2"
},
"RootFS": {
"Type": "layers",
"Layers": [
"sha256:7f5cbd8cc787c8d628630756bcc7240e6c96b876c2882e6fc980a8b60cdfa274"
]
},
"Metadata": {
"LastTagTime": "0001-01-01T00:00:00Z"
}
}
]
but if i installed Selenium with pip3 install selenium
. It is working as expected.
With Selenium, although the selenium can login, but cookies looks not working
oj login https://codeforces.com/contest/1763/problem/A
[INFO] online-judge-tools 11.5.1 (+ online-judge-api-client 10.10.1)
[INFO] load cookie from: /home/cromarmot/.local/share/online-judge-tools/cookie.jar
[NETWORK] GET: https://codeforces.com/enter
[NETWORK] 200 OK
[FAILURE] You are not signed in.
[INFO] Trying to open Chrome via WebDriver...
[INFO] Opening the URL via WebDriver: https://codeforces.com/enter
[INFO] Please do the followings:
1. login in the GUI browser
2. close the GUI browser
[INFO] Copying cookies via WebDriver...
[NETWORK] GET: https://codeforces.com/enter
[NETWORK] 302 Found
[SUCCESS] You have already signed in.
[INFO] save cookie to: /home/cromarmot/.local/share/online-judge-tools/cookie.jar
oj submit https://codeforces.com/contest/1763/problem/A Main.cpp
[INFO] online-judge-tools 11.5.1 (+ online-judge-api-client 10.10.1)
[INFO] code (460 byte):
#include_<bits/stdc++.h>
using_namespace_std;
typedef_long_long_ll;
#define_rep(i,a,n)_for_(ll_i=a;i<(ll)n;i++)
ll_read(){ll_r;scanf("%lld",&r);return_r;}
void_w(){
__int_n_=_read();
... (10 lines) ...
__}
__printf("%d\n",ans);
}
int_main(){
__int_t_=_read();
__while(t--)_w();
__return_0;
}
[INFO] load cookie from: /home/cromarmot/.local/share/online-judge-tools/cookie.jar
[NETWORK] GET: https://codeforces.com/enter
[NETWORK] 200 OK
[ERROR] You are not logged in. Please run $ oj login https://codeforces.com/contest/1763/problem/A
[INFO] save cookie to: /home/cromarmot/.local/share/online-judge-tools/cookie.jar
I think codeforces must change some config in it's server. I tried oj login https://codeforces.com/contest/1763/problem/A
just now( 2022-12-31 12:59:30 )with the cookies.jar created in above(12-25), it works properly. It is very weird
I think if the server change again, this issue should be still can reproduce, but now the oj
working properly.
Summary / 概要
Login to codeforces is failing unexpectedally. I had the library installed on my local for about an year but suddenly when i tried to create new cookie file, it was failing at login
Steps to reproduce / 再現方法
environments:
Expected behavior / 期待される挙動
Should login and create cookie file
Actual behavior / 実際の挙動
Other notes / その他