@@ -681,19 +681,17 @@ Network
681
681
- **ptp **: stands for "point to point"; it's the destination address on a
682
682
point to point interface (typically a VPN). *broadcast * and *ptp * are
683
683
mutually exclusive. May be ``None ``.
684
- - **flags **: an integer defining the network flags, like those returned
685
- from `getifaddrs ` on POSIX (may be ``None ``).
686
684
687
685
Example::
688
686
689
687
>>> import psutil
690
688
>>> psutil.net_if_addrs()
691
- {'lo': [snicaddr(family=<AddressFamily.AF_INET: 2>, address='127.0.0.1', netmask='255.0.0.0', broadcast='127.0.0.1', ptp=None, flags=73 ),
692
- snicaddr(family=<AddressFamily.AF_INET6: 10>, address='::1', netmask='ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff', broadcast=None, ptp=None, flags=73 ),
693
- snicaddr(family=<AddressFamily.AF_LINK: 17>, address='00:00:00:00:00:00', netmask=None, broadcast='00:00:00:00:00:00', ptp=None, flags=73 )],
694
- 'wlan0': [snicaddr(family=<AddressFamily.AF_INET: 2>, address='192.168.1.3', netmask='255.255.255.0', broadcast='192.168.1.255', ptp=None, flags=4163 ),
695
- snicaddr(family=<AddressFamily.AF_INET6: 10>, address='fe80::c685:8ff:fe45:641%wlan0', netmask='ffff:ffff:ffff:ffff::', broadcast=None, ptp=None, flags=4163 ),
696
- snicaddr(family=<AddressFamily.AF_LINK: 17>, address='c4:85:08:45:06:41', netmask=None, broadcast='ff:ff:ff:ff:ff:ff', ptp=None, flags=4163 )]}
689
+ {'lo': [snicaddr(family=<AddressFamily.AF_INET: 2>, address='127.0.0.1', netmask='255.0.0.0', broadcast='127.0.0.1', ptp=None),
690
+ snicaddr(family=<AddressFamily.AF_INET6: 10>, address='::1', netmask='ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff', broadcast=None, ptp=None),
691
+ snicaddr(family=<AddressFamily.AF_LINK: 17>, address='00:00:00:00:00:00', netmask=None, broadcast='00:00:00:00:00:00', ptp=None)],
692
+ 'wlan0': [snicaddr(family=<AddressFamily.AF_INET: 2>, address='192.168.1.3', netmask='255.255.255.0', broadcast='192.168.1.255', ptp=None),
693
+ snicaddr(family=<AddressFamily.AF_INET6: 10>, address='fe80::c685:8ff:fe45:641%wlan0', netmask='ffff:ffff:ffff:ffff::', broadcast=None, ptp=None),
694
+ snicaddr(family=<AddressFamily.AF_LINK: 17>, address='c4:85:08:45:06:41', netmask=None, broadcast='ff:ff:ff:ff:ff:ff', ptp=None)]}
697
695
>>>
698
696
699
697
See also `nettop.py `_ and `ifconfig.py `_ for an example application.
@@ -708,7 +706,7 @@ Network
708
706
interface (that's why dict values are lists).
709
707
710
708
.. note ::
711
- *broadcast *, * ptp *, and *flags * are not supported on Windows and are always ``None ``.
709
+ *broadcast * and *ptp * are not supported on Windows and are always ``None ``.
712
710
713
711
.. versionadded :: 3.0.0
714
712
@@ -717,8 +715,6 @@ Network
717
715
.. versionchanged :: 4.4.0 added support for *netmask* field on Windows which
718
716
is no longer ``None ``.
719
717
720
- .. versionchanged :: 5.9.0 *flags* field was added.
721
-
722
718
.. function :: net_if_stats()
723
719
724
720
Return information about each NIC (network interface card) installed on the
@@ -733,20 +729,23 @@ Network
733
729
- **speed **: the NIC speed expressed in mega bits (MB), if it can't be
734
730
determined (e.g. 'localhost') it will be set to ``0 ``.
735
731
- **mtu **: NIC's maximum transmission unit expressed in bytes.
732
+ - **flags **: a string of comma-separate flags on the interface (may be ``None ``).
736
733
737
734
Example:
738
735
739
736
>>> import psutil
740
737
>>> psutil.net_if_stats()
741
- {'eth0': snicstats(isup=True, duplex=<NicDuplex.NIC_DUPLEX_FULL: 2>, speed=100, mtu=1500),
742
- 'lo': snicstats(isup=True, duplex=<NicDuplex.NIC_DUPLEX_UNKNOWN: 0>, speed=0, mtu=65536)}
738
+ {'eth0': snicstats(isup=True, duplex=<NicDuplex.NIC_DUPLEX_FULL: 2>, speed=100, mtu=1500, flags='up,broadcast,running,multicast' ),
739
+ 'lo': snicstats(isup=True, duplex=<NicDuplex.NIC_DUPLEX_UNKNOWN: 0>, speed=0, mtu=65536, flags='up,loopback,running' )}
743
740
744
741
Also see `nettop.py `_ and `ifconfig.py `_ for an example application.
745
742
746
743
.. versionadded :: 3.0.0
747
744
748
745
.. versionchanged :: 5.7.3 `isup` on UNIX also checks whether the NIC is running.
749
746
747
+ .. versionchanged :: 5.9.0 *flags* field was added.
748
+
750
749
Sensors
751
750
-------
752
751
0 commit comments