Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.debian.user > #205533
| From | David Wright <deblis@lionunicorn.co.uk> |
|---|---|
| Newsgroups | linux.debian.user |
| Subject | Re: get my ip address |
| Date | 2019-02-20 05:40 +0100 |
| Message-ID | <xtrPP-5kK-1@gated-at.bofh.it> (permalink) |
| References | <xrJ4u-2o3-9@gated-at.bofh.it> <xrJxx-2NR-25@gated-at.bofh.it> <xrO4a-5lu-5@gated-at.bofh.it> <xs5eF-7BH-1@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Sat 16 Feb 2019 at 11:16:23 (+0100), tony wrote: > On 15/02/2019 16:52, David Wright wrote: > > On Fri 15 Feb 2019 at 12:02:20 (+0100), Markus Schönhaber wrote: > >> Tony, 15.2.2019, 11:11:29 +0100: > >> > >>> Debian 9. I need to read my IPv6 address into a python script. > >>> > >>> I am aware that I can call ip a and parse the result. The parsing, > >>> whilst quite achievable, is slightly tricky, but I can manage the RE, so > >>> that's not my question. > >>> > >>> Is there any other way to obtain this data, maybe from /sys? > >> > >> Take a look at this: > >> https://pypi.org/project/netifaces/ > >> > >> This is packaged on stretch as python[3]-netifaces > > > > That's probably best if your destination is a Python program. > > > > Otherwise, for scripting, it's easy to overlook ip -o a > > which makes parsing much easier. But note that you may then > > need to be more specific, eg compare > > > > $ ip a > > > > with > > > > $ ip -o l > > $ ip -o a > > > Thanks to all who replied, I hadn't expected pointers to the various > python libraries, for which I am very grateful. All I asked for was a > simple way of directly accessing the hardware, but that does not seem to > be available. > > Failing that, I had indeed overlooked the -o flag oo ip a, which indeed > makes parsing easier. However, it does appear that netifaces offers the > most usable solution, so a cigar to David Wright for this suggestion. I only quoted netifaces, so Markus Schönhaber deserves the cigar. Cheers, David.
Back to linux.debian.user | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
get my ip address tony <lists@vanderhoff.org> - 2019-02-15 11:40 +0100
Re: get my ip address <tomas@tuxteam.de> - 2019-02-15 11:50 +0100
Re: get my ip address Markus Schönhaber <debian-user@list-post.mks-mail.de> - 2019-02-15 12:10 +0100
Re: get my ip address David Wright <deblis@lionunicorn.co.uk> - 2019-02-15 17:00 +0100
Re: get my ip address David Wright <deblis@lionunicorn.co.uk> - 2019-02-16 01:00 +0100
Re: get my ip address John Crawley <john@bunsenlabs.org> - 2019-02-16 03:20 +0100
Re: get my ip address David Wright <deblis@lionunicorn.co.uk> - 2019-02-16 06:30 +0100
Re: get my ip address John Crawley <john@bunsenlabs.org> - 2019-02-17 05:00 +0100
Re: get my ip address David Wright <deblis@lionunicorn.co.uk> - 2019-02-20 05:40 +0100
Re: get my ip address tony <lists@vanderhoff.org> - 2019-02-16 11:20 +0100
Re: get my ip address David Wright <deblis@lionunicorn.co.uk> - 2019-02-20 05:40 +0100
Re: get my ip address Greg Wooledge <wooledg@eeg.ccf.org> - 2019-02-19 16:20 +0100
Re: get my ip address tony <lists@vanderhoff.org> - 2019-02-19 16:50 +0100
Re: get my ip address Dan Ritter <dsr@randomstring.org> - 2019-02-19 17:40 +0100
Re: get my ip address tony <lists@vanderhoff.org> - 2019-02-19 18:10 +0100
Re: get my ip address Greg Wooledge <wooledg@eeg.ccf.org> - 2019-02-19 18:10 +0100
Re: get my ip address tony <lists@vanderhoff.org> - 2019-02-20 11:40 +0100
Re: get my ip address Dan Ritter <dsr@randomstring.org> - 2019-02-20 13:30 +0100
Re: get my ip address tony <lists@vanderhoff.org> - 2019-02-20 14:00 +0100
Re: get my ip address Jonathan de Boyne Pollard <J.deBoynePollard-newsgroups@NTLWorld.COM> - 2019-02-28 15:40 +0100
csiph-web