online-judge-tools / api-client

API client to develop tools for competitive programming
MIT License
64 stars 18 forks source link

`oj-api login-service --check` crashes #53

Closed kmyk closed 4 years ago

kmyk commented 4 years ago

To reproduce

  1. run $ oj-api login-service --check https://codeforces.com

Actual behavior

An exception is thrown at

https://github.com/online-judge-tools/api-client/blob/3d005ac622c160f34b7355e30380e5de2b02a38c/onlinejudge_api/login_service.py#L28

Error log

$ oj-api login-service --check https://codeforces.com
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/user/.local/share/online-judge-tools/cookie.jar
ERROR:root:
Traceback (most recent call last):
  File "/home/user/.local/lib/python3.6/site-packages/onlinejudge_api/main.py", line 257, in main
    result = login_service.main(service, username=parsed.username, password=parsed.password, check_only=parsed.check, session=session)
  File "/home/user/.local/lib/python3.6/site-packages/onlinejudge_api/login_service.py", line 28, in main
    assert username is None
AssertionError
{"status": "error", "messages": ["AssertionError"], "result": null}
kmyk commented 4 years ago

In Zsh, $USERNAME seems defined unexpectedly... https://qiita.com/quenhulu/items/61edc5dffa711b08d64c