René's URL Explorer Experiment


Title: How to do equivalent of nmcli connection up 'Wired connection 2'? · python-sdbus/python-sdbus-networkmanager · Discussion #70 · GitHub

Open Graph Title: How to do equivalent of nmcli connection up 'Wired connection 2'? · python-sdbus/python-sdbus-networkmanager · Discussion #70

X Title: How to do equivalent of nmcli connection up 'Wired connection 2'? · python-sdbus/python-sdbus-networkmanager · Discussion #70

Description: How to do equivalent of nmcli connection up 'Wired connection 2'?

Open Graph Description: Hi, I can set the IP etc on my interface and apply to the bus: from sdbus_async.networkmanager import NetworkManagerSettings, NetworkConnectionSettings # Ideally want to look up by device eth1 conn...

X Description: Hi, I can set the IP etc on my interface and apply to the bus: from sdbus_async.networkmanager import NetworkManagerSettings, NetworkConnectionSettings # Ideally want to look up by device eth1 conn...

Opengraph URL: https://github.com/python-sdbus/python-sdbus-networkmanager/discussions/70

X: @github

direct link

Domain: patch-diff.githubusercontent.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"QAPage","mainEntity":{"@type":"Question","name":"How to do equivalent of nmcli connection up 'Wired connection 2'?","text":"

Hi,

\n

I can set the IP etc on my interface and apply to the bus:

\n
        from sdbus_async.networkmanager import NetworkManagerSettings, NetworkConnectionSettings\n\n# Ideally want to look up by device eth1\n        connection_paths = await NetworkManagerSettings().get_connections_by_id(self.connection_id)\n        if not connection_paths:\n            raise Exception(f\"No connection found with id {self.connection_id}\")\n\n        connection_manager = NetworkConnectionSettings(connection_paths[0])\n        connection_profile = await connection_manager.get_profile()\n        settings = connection_profile.to_settings_dict()\n        \n        return settings, connection_manager\n\nasync def _network_linux_apply(self):\n        from sdbus_async.networkmanager.settings import ConnectionProfile\n        settings, connection_manager = await self._network_linux_profile()  \n        ipv4 = settings['ipv4']\n        ipv4['address-data'][0]['address'] = self.ap_ip\n        ipv4['address-data'][0]['prefix'] = sum([bin(int(x)).count('1') for x in self.netmask.split('.')])\n        ipv4['gateway'] = self.gateway\n        ipv4['dns-data'][0] = self.dns \n        new_connection_profile = ConnectionProfile.from_settings_dict(settings)\n        await connection_manager.update(new_connection_profile.to_dbus())\n        await connection_manager.save()\n\n
\n

However to get the device to use the new IP, I have to issue nmcli connection up 'Wired connection 2'

\n

How can this command by sent via the python AP?

\n

Thanks in advance

","upvoteCount":1,"answerCount":1,"acceptedAnswer":{"@type":"Answer","text":"

Thanks so much .. that did the job! You don't need to deactivate on the linux I'm using.

\n

Here is the update code should anyone else need it:

\n
    async def _network_linux_apply(self):\n        from sdbus_async.networkmanager.settings import ConnectionProfile\n        settings, connection_manager = await self._network_linux_profile()  \n        ipv4 = settings['ipv4']\n        ipv4['address-data'][0]['address'] = self.ap_ip\n        ipv4['address-data'][0]['prefix'] = sum([bin(int(x)).count('1') for x in self.netmask.split('.')])\n        ipv4['gateway'] = self.gateway\n        ipv4['dns-data'][0] = self.dns \n        new_connection_profile = ConnectionProfile.from_settings_dict(settings)\n        await connection_manager.update(new_connection_profile.to_dbus())\n\n        from sdbus_async.networkmanager import NetworkManagerSettings, NetworkManager\n        connection_paths = await NetworkManagerSettings().get_connections_by_id(self.connection_id)\n        await nm.activate_connection(connection_paths[0])\n
","upvoteCount":0,"url":"https://github.com/python-sdbus/python-sdbus-networkmanager/discussions/70#discussioncomment-12368031"}}}

route-pattern/_view_fragments/Voltron::DiscussionsFragmentsController/show/:user_id/:repository/:discussion_number/discussion_layout(.:format)
route-controllervoltron_discussions_fragments
route-actiondiscussion_layout
fetch-noncev2:7512b24e-c185-094d-a1eb-fb4686caa1d2
current-catalog-service-hash9f0abe34da433c9b6db74bffa2466494a717b579a96b30a5d252e5090baea7be
request-idB3BC:144419:3830FC:48C932:698D4E11
html-safe-nonce906263162537de41d0d5b6a8385eb1086fe0b5c3c3a62a8f1c63266f40d5fbe9
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCM0JDOjE0NDQxOTozODMwRkM6NDhDOTMyOjY5OEQ0RTExIiwidmlzaXRvcl9pZCI6Ijk4Mzc1MTg3OTk4MzcxMzgwOSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac6dce05d894c46682238cf7a0a6188729cfe5504d210da66b4e78248fa5ee1904
hovercard-subject-tagdiscussion:8022608
github-keyboard-shortcutsrepository,network-graph,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/discussions_fragments/discussion_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/Voltron::DiscussionsFragmentsController/show/python-sdbus/python-sdbus-networkmanager/70/discussion_layout
twitter:imagehttps://opengraph.githubassets.com/674185ea5b802367a3c04273cf45575c5f9572e6fe7ca423049fa950baeb201e/python-sdbus/python-sdbus-networkmanager/discussions/70
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/674185ea5b802367a3c04273cf45575c5f9572e6fe7ca423049fa950baeb201e/python-sdbus/python-sdbus-networkmanager/discussions/70
og:image:altHi, I can set the IP etc on my interface and apply to the bus: from sdbus_async.networkmanager import NetworkManagerSettings, NetworkConnectionSettings # Ideally want to look up by device eth1 conn...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
Nonec0818105fa276287e9369cfdefa0a0fa7953719791ceff9b94d69623c0a4fe8a
turbo-cache-controlno-preview
go-importgithub.com/python-sdbus/python-sdbus-networkmanager git https://github.com/python-sdbus/python-sdbus-networkmanager.git
octolytics-dimension-user_id88226657
octolytics-dimension-user_loginpython-sdbus
octolytics-dimension-repository_id384529652
octolytics-dimension-repository_nwopython-sdbus/python-sdbus-networkmanager
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id384529652
octolytics-dimension-repository_network_root_nwopython-sdbus/python-sdbus-networkmanager
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
releasea95a17cc440c14d4fcddc0641bc1136fa8d908f0
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://patch-diff.githubusercontent.com/python-sdbus/python-sdbus-networkmanager/discussions/70#start-of-content
https://patch-diff.githubusercontent.com/
Sign in https://patch-diff.githubusercontent.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython-sdbus%2Fpython-sdbus-networkmanager%2Fdiscussions%2F70
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub SparkBuild and deploy intelligent appshttps://github.com/features/spark
GitHub ModelsManage and compare promptshttps://github.com/features/models
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
GitHub SponsorsFund open source developershttps://github.com/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/accelerator
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://patch-diff.githubusercontent.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython-sdbus%2Fpython-sdbus-networkmanager%2Fdiscussions%2F70
Sign up https://patch-diff.githubusercontent.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fdiscussions_fragments%2Fdiscussion_layout&source=header-repo&source_repo=python-sdbus%2Fpython-sdbus-networkmanager
Reloadhttps://patch-diff.githubusercontent.com/python-sdbus/python-sdbus-networkmanager/discussions/70
Reloadhttps://patch-diff.githubusercontent.com/python-sdbus/python-sdbus-networkmanager/discussions/70
Reloadhttps://patch-diff.githubusercontent.com/python-sdbus/python-sdbus-networkmanager/discussions/70
python-sdbus https://patch-diff.githubusercontent.com/python-sdbus
python-sdbus-networkmanagerhttps://patch-diff.githubusercontent.com/python-sdbus/python-sdbus-networkmanager
Notifications https://patch-diff.githubusercontent.com/login?return_to=%2Fpython-sdbus%2Fpython-sdbus-networkmanager
Fork 11 https://patch-diff.githubusercontent.com/login?return_to=%2Fpython-sdbus%2Fpython-sdbus-networkmanager
Star 43 https://patch-diff.githubusercontent.com/login?return_to=%2Fpython-sdbus%2Fpython-sdbus-networkmanager
Code https://patch-diff.githubusercontent.com/python-sdbus/python-sdbus-networkmanager
Issues 2 https://patch-diff.githubusercontent.com/python-sdbus/python-sdbus-networkmanager/issues
Pull requests 1 https://patch-diff.githubusercontent.com/python-sdbus/python-sdbus-networkmanager/pulls
Discussions https://patch-diff.githubusercontent.com/python-sdbus/python-sdbus-networkmanager/discussions
Actions https://patch-diff.githubusercontent.com/python-sdbus/python-sdbus-networkmanager/actions
Security 0 https://patch-diff.githubusercontent.com/python-sdbus/python-sdbus-networkmanager/security
Insights https://patch-diff.githubusercontent.com/python-sdbus/python-sdbus-networkmanager/pulse
Code https://patch-diff.githubusercontent.com/python-sdbus/python-sdbus-networkmanager
Issues https://patch-diff.githubusercontent.com/python-sdbus/python-sdbus-networkmanager/issues
Pull requests https://patch-diff.githubusercontent.com/python-sdbus/python-sdbus-networkmanager/pulls
Discussions https://patch-diff.githubusercontent.com/python-sdbus/python-sdbus-networkmanager/discussions
Actions https://patch-diff.githubusercontent.com/python-sdbus/python-sdbus-networkmanager/actions
Security https://patch-diff.githubusercontent.com/python-sdbus/python-sdbus-networkmanager/security
Insights https://patch-diff.githubusercontent.com/python-sdbus/python-sdbus-networkmanager/pulse
Answered https://patch-diff.githubusercontent.com/python-sdbus/python-sdbus-networkmanager/discussions/70#discussioncomment-12368031
ict-rhys-williamshttps://patch-diff.githubusercontent.com/ict-rhys-williams
ict-rhys-williams https://patch-diff.githubusercontent.com/ict-rhys-williams
Q&Ahttps://patch-diff.githubusercontent.com/python-sdbus/python-sdbus-networkmanager/discussions/categories/q-a
How to do equivalent of nmcli connection up 'Wired connection 2'? https://patch-diff.githubusercontent.com/python-sdbus/python-sdbus-networkmanager/discussions/70#top
ict-rhys-williams https://patch-diff.githubusercontent.com/ict-rhys-williams
Answered https://patch-diff.githubusercontent.com/python-sdbus/python-sdbus-networkmanager/discussions/70#discussioncomment-12368031
ict-rhys-williamshttps://patch-diff.githubusercontent.com/ict-rhys-williams
Return to tophttps://patch-diff.githubusercontent.com/python-sdbus/python-sdbus-networkmanager/discussions/70#top
Please reload this pagehttps://patch-diff.githubusercontent.com/python-sdbus/python-sdbus-networkmanager/discussions/70
https://patch-diff.githubusercontent.com/python-sdbus/python-sdbus-networkmanager/discussions/70
ict-rhys-williams https://patch-diff.githubusercontent.com/ict-rhys-williams
Feb 28, 2025 https://patch-diff.githubusercontent.com/python-sdbus/python-sdbus-networkmanager/discussions/70#discussion-8022608
Give feedback.https://patch-diff.githubusercontent.com/python-sdbus/python-sdbus-networkmanager/discussions/70
ict-rhys-williams https://patch-diff.githubusercontent.com/ict-rhys-williams
Mar 2, 2025 https://github.com/python-sdbus/python-sdbus-networkmanager/discussions/70#discussioncomment-12368031
View full answer https://patch-diff.githubusercontent.com/python-sdbus/python-sdbus-networkmanager/discussions/70#discussioncomment-12368031
Oldest https://patch-diff.githubusercontent.com/python-sdbus/python-sdbus-networkmanager/discussions/70?sort=old
Newest https://patch-diff.githubusercontent.com/python-sdbus/python-sdbus-networkmanager/discussions/70?sort=new
Top https://patch-diff.githubusercontent.com/python-sdbus/python-sdbus-networkmanager/discussions/70?sort=top
Please reload this pagehttps://patch-diff.githubusercontent.com/python-sdbus/python-sdbus-networkmanager/discussions/70
https://patch-diff.githubusercontent.com/python-sdbus/python-sdbus-networkmanager/discussions/70
Please reload this pagehttps://patch-diff.githubusercontent.com/python-sdbus/python-sdbus-networkmanager/discussions/70
https://patch-diff.githubusercontent.com/python-sdbus/python-sdbus-networkmanager/discussions/70
igo95862 https://patch-diff.githubusercontent.com/igo95862
Feb 28, 2025 https://patch-diff.githubusercontent.com/python-sdbus/python-sdbus-networkmanager/discussions/70#discussioncomment-12354283
@ict-rhys-williamshttps://github.com/ict-rhys-williams
connection from the main NetworkManager objecthttps://python-sdbus-networkmanager.readthedocs.io/en/latest/other_interfaces.html#sdbus_async.networkmanager.NetworkManagerInterfaceAsync.activate_connection
NetworkManager main objecthttps://python-sdbus-networkmanager.readthedocs.io/en/latest/objects.html#sdbus_async.networkmanager.NetworkManager
Give feedback.https://patch-diff.githubusercontent.com/python-sdbus/python-sdbus-networkmanager/discussions/70
https://patch-diff.githubusercontent.com/ict-rhys-williams
Please reload this pagehttps://patch-diff.githubusercontent.com/python-sdbus/python-sdbus-networkmanager/discussions/70
https://patch-diff.githubusercontent.com/python-sdbus/python-sdbus-networkmanager/discussions/70
ict-rhys-williamshttps://patch-diff.githubusercontent.com/ict-rhys-williams
Mar 2, 2025 https://patch-diff.githubusercontent.com/python-sdbus/python-sdbus-networkmanager/discussions/70#discussioncomment-12368031
Give feedback.https://patch-diff.githubusercontent.com/python-sdbus/python-sdbus-networkmanager/discussions/70
ict-rhys-williamshttps://patch-diff.githubusercontent.com/ict-rhys-williams
Sign up for freehttps://patch-diff.githubusercontent.com/join?source=comment-repo
Sign in to commenthttps://patch-diff.githubusercontent.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython-sdbus%2Fpython-sdbus-networkmanager%2Fdiscussions%2F70
🙏 Q&A https://patch-diff.githubusercontent.com/python-sdbus/python-sdbus-networkmanager/discussions/categories/q-a
https://patch-diff.githubusercontent.com/ict-rhys-williams
https://patch-diff.githubusercontent.com/igo95862
https://patch-diff.githubusercontent.com/python-sdbus/python-sdbus-networkmanager/discussions/70
https://patch-diff.githubusercontent.com/settings/replies?return_to=1
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.