mewhrzad / marzpy Goto Github PK
View Code? Open in Web Editor NEWA Python library that helps you easily use Marzban's API panel
License: MIT License
A Python library that helps you easily use Marzban's API panel
License: MIT License
Hi, the next stage of your project development can be logged, it's a good idea and efficient. The ability to set up like the panel would be great.
panel = Marzban('user'pass'.', 'https://....')
mytoken = await panel.get_token()
print(mytoken)
try:
new_user = User(
username="Mewhrzad",
proxies={
"vmess": {"id": "35e7e39c-7d5c-1f4b-8b71-508e4f37ff53"},
},
inbounds={"vmess": ["VMess TCP"]},
expire=0,
data_limit=0,
data_limit_reset_strategy="no_reset",
)
result = await panel.add_user(user=new_user, token=mytoken) # return new User object
print(result.username)
except Exception as ex:
print(ex)
return :
module aiohttp has no attribute exceptions
سلام صفت usage_coefficient
که در آپدیت جدید مرزبان به نود ها اضافه شده در کتابخانه وجود نداره.
خطای گرفته شده:
File ".venv/lib/python3.11/site-packages/marzpy/api/node.py", line 106, in get_all_nodes
node_list.append(Node(**node))
^^^^^^^^^^^^
TypeError: Node.__init__() got an unexpected keyword argument 'usage_coefficient'
من این مشکل رو با اضافه کردن این اتریبیوت به کلاس Node
برای خودم حل کردم:
class Node:
def __init__(
self,
name="",
address="",
port=0,
api_port=0,
certificate="",
id=0,
xray_version="",
status="",
message="",
usage_coefficient=0 # new
):
self.name = name
self.address = address
self.port = port
self.api_port = api_port
self.certificate = certificate
self.id = id
self.xray_version = xray_version
self.status = status
self.message = message
self.usage_coefficient = usage_coefficient # new
TypeError: User.init() got an unexpected keyword argument 'note'
It looks like Marzban has been updated and returns a new 'note' property in the response
https://api.marzban.dev/#tag/User/operation/add_user
{
"proxies": { },
"expire": 0,
"data_limit": 0,
"data_limit_reset_strategy": "no_reset",
"inbounds": { },
"note": "string",
"sub_updated_at": "2019-08-24T14:15:22Z",
"sub_last_user_agent": "string",
"online_at": "2019-08-24T14:15:22Z",
"on_hold_expire_duration": 0,
"on_hold_timeout": "2019-08-24T14:15:22Z",
"username": "string",
"status": "active",
"used_traffic": 0,
"lifetime_used_traffic": 0,
"created_at": "2019-08-24T14:15:22Z",
"links": [ ],
"subscription_url": "",
"excluded_inbounds": { }
}
New properties also:
sub_updated_at="",
sub_last_user_agent="",
online_at="",
on_hold_expire_duration="",
on_hold_timeout="",
Hello, community!
Tell me, please, can i enable user in Marzban by Marzpy without sending all required parameters?
I need to send method 'modify_user' with all proxies and inbounds, but enabling or disabling user is elementary action and can i do it by sending request only with username?
If i sending 'modify_user' without proxies and inbounds i get:
TypeError: User.__init__() missing 2 required positional arguments: 'proxies' and 'inbounds'
سلام.
اکثر فانکشن های پکیج این ارور رو دریافت میکنند.
TypeError: init() got an unexpected keyword argument 'note'
فکر میکنم بخاطر آپدیت جدید پنل مرزبان باشه.
when i use :
token = await panel.get_token()
result = await panel.add_node(
token,
Node('france', 'fr.example.net')
)
i get this error :
TypeError: Node.__init__() got an unexpected keyword argument 'usage_coefficient'
but the node is created in the panel
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.