What could be the problem? Bad login, Error 404
Closed this issue · 4 comments
Goosegit11 commented
Code:
from pyxui import XUI
import json
import urllib3
urllib3.disable_warnings()
# Basic:
xui = XUI(
full_address="https://<ip>:<port>/<webbasepath>",
panel="sanaei", # Your panel name, "alireza" or "sanaei"
https=False
)
from pyxui.errors import BadLogin
USERNAME = 'user'
PASSWORD = 'pass'
try:
xui.login(USERNAME, PASSWORD)
except BadLogin:
print("Bad login")
get_inbounds = xui.get_inbounds()
print(json.dumps(get_inbounds, indent=4))
Error:
Bad login
Traceback (most recent call last):
File "/root/py-scripts/main.py", line 48, in <module>
get_inbounds = xui.get_inbounds()
File "/root/py-scripts/lib/python3.10/site-packages/pyxui/methods/inbounds.py", line 28, in get_inbounds
return self.verify_response(response)
File "/root/py-scripts/lib/python3.10/site-packages/pyxui/methods/base.py", line 53, in verify_response
raise errors.NotFound()
pyxui.errors.NotFound: [NOT_FOUND] Error 404 has been received.
Username and password are right.
Goosegit11 commented
I added session_string
to the xui
and when logging in it says ALREADY LOGGED.
Then I remove the code with login and still the same 'Not found' error. I can't get inbounds, get client or add client.
Goosegit11 commented
Going to the https://ip:port/basepath/panel/api/inbounds/list
in browser works, returns json with inbounds.
staliox commented
Going to the
https://ip:port/basepath/panel/api/inbounds/list
in browser works, returns json with inbounds.
make sure your end of url doesn't contain /
Goosegit11 commented
https://github.com/iwatkot/py3xui
I found this newer library, it works. Thanks for your contribution anyway 👍