Closed andrey-pr closed 1 year ago
How to allow?
Resolved issues
Pls review again
Pls review again
Could you do the args
unpacking?
It would be asyncio.run(add_vpn_connection_async(**vars(args)))
. This allows for better typing as there will be explicit keywords instead of opaque args
.
It would be asyncio.run(add_vpn_connection_async(**vars(args))). This allows for better typing as there will be explicit keywords instead of opaque args.
Ok, but how to accept this kind of arguments in function?
Ok, but how to accept this kind of arguments in function?
Add the keyword arguments matching the args attributes.
For example, there is args.conn_id
so the keyword argument would be conn_id: str
.
The function would look like this:
async def add_vpn_connection_async(
conn_id: str,
dev: str,
...............
) -> str:
Instead of ...............
are all the keywords that args
has.
Probably better to use default=str(uuid4())
straight away so it the type can simple be str
.
Fixed
I have one question about further library usage. How to connect existing connection?
I have one question about further library usage. How to connect existing connection?
Probably using NetworkManager.activate_connection
.
Probably using NetworkManager.activate_connection.
I can not understand how to create object of NetworkManagerInterfaceAsync
. Can you show me some example how to do it?
Probably using NetworkManager.activate_connection.
I can not understand how to create object of
NetworkManagerInterfaceAsync
. Can you show me some example how to do it?
Just use the NetworkManager
class. It inherits from NetworkManagerInterfaceAsync
.
The difference is NetworkManager
is an object that automatically proxies to /org/freedesktop/NetworkManager
and NetworkManagerInterfaceAsync
is an interface class that has all the methods and properties definitions.
So it would look something like this:
nm = NetworkManager()
nm.activate_connection(vpn_connection_path, "/", "/")
It works. Thank you.
await nm.activate_connection(vpn_connection_path, "/", "/")
Thank you for submitting pull request. Allow me to review it.