summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIlya Etingof <etingof@gmail.com>2018-04-21 18:46:34 +0200
committerIlya Etingof <etingof@gmail.com>2018-04-21 18:46:34 +0200
commit8935532ee70df78ea73741347c81b6b6d5fea57a (patch)
tree5bea90c20449b9da760885e8da2cb65a1f788b1f
parent2346e0a9af12681bd093adc2e6b2ae525743c557 (diff)
parent2b27b49db77ff6fdad311e122da7c1305fccc095 (diff)
downloadpysnmp-git-8935532ee70df78ea73741347c81b6b6d5fea57a.tar.gz
Merge branch 'master' of github.com:etingof/pysnmp
-rw-r--r--README.md6
-rw-r--r--docs/source/contents.rst2
-rw-r--r--docs/source/download.rst12
-rw-r--r--pysnmp/carrier/asyncio/dgram/base.py12
-rw-r--r--pysnmp/carrier/asyncio/dispatch.py10
5 files changed, 28 insertions, 14 deletions
diff --git a/README.md b/README.md
index e85e1ac3..31f939c3 100644
--- a/README.md
+++ b/README.md
@@ -1,8 +1,8 @@
SNMP library for Python
-----------------------
-[![PyPI](https://img.shields.io/pypi/v/pysnmp.svg?maxAge=2592000)](https://pypi.python.org/pypi/pysnmp)
-[![Python Versions](https://img.shields.io/pypi/pyversions/pysnmp.svg)](https://pypi.python.org/pypi/pysnmp/)
+[![PyPI](https://img.shields.io/pypi/v/pysnmp.svg?maxAge=2592000)](https://pypi.org/project/pysnmp/)
+[![Python Versions](https://img.shields.io/pypi/pyversions/pysnmp.svg)](https://pypi.org/project/pysnmp/)
[![Build status](https://travis-ci.org/etingof/pysnmp.svg?branch=master)](https://secure.travis-ci.org/etingof/pysnmp)
[![GitHub license](https://img.shields.io/badge/license-BSD-blue.svg)](https://raw.githubusercontent.com/etingof/pysnmp/master/LICENSE.txt)
@@ -44,7 +44,7 @@ Features, specific to SNMPv3 model include:
Download & Install
------------------
-The PySNMP software is freely available for download from [PyPI](https://pypi.python.org/pypi/pysnmp)
+The PySNMP software is freely available for download from [PyPI](https://pypi.org/project/pysnmp/)
and [GitHub](https://github.com/etingof/pysnmp.git).
Just run:
diff --git a/docs/source/contents.rst b/docs/source/contents.rst
index 2d97af12..d52b0a63 100644
--- a/docs/source/contents.rst
+++ b/docs/source/contents.rst
@@ -24,7 +24,7 @@ examples are written for the 4.4 and later versions in mind.
Older materials are still available under the obsolete section.
Besides the libraries, a set of pure-Python
-`command-line tools <https://pypi.python.org/pypi/snmpclitools/>`_
+`command-line tools <https://pypi.org/project/snmpclitools/>`_
are shipped along with the system. Those tools mimic the interface
and behaviour of popular Net-SNMP snmpget/snmpset/snmpwalk utilities.
They may be useful in a cross-platform situations as well as a testing
diff --git a/docs/source/download.rst b/docs/source/download.rst
index 87743486..4026d891 100644
--- a/docs/source/download.rst
+++ b/docs/source/download.rst
@@ -6,7 +6,7 @@ Download PySNMP
The PySNMP software is provided under terms and conditions of BSD-style
license, and can be freely downloaded from
-`PyPI <http://pypi.python.org/pypi/pysnmp/>`_ or
+`PyPI <https://pypi.org/project/pysnmp/>`_ or
GitHub (`master branch <https://github.com/etingof/pysnmp/archive/master.zip>`_).
@@ -30,7 +30,7 @@ or
In case you do not have the easy_install command on your system but still
would like to use the on-line package installation method, please install
-`setuptools <http://pypi.python.org/pypi/setuptools>`_ package by
+`setuptools <https://pypi.org/project/setuptools/>`_ package by
downloading and running `ez_setup.pz <https://bootstrap.pypa.io/ez_setup.py>`_ bootstrap:
.. code-block:: bash
@@ -42,15 +42,15 @@ In case you are installing PySNMP on an off-line system, the following
packages need to be downloaded and installed for PySNMP to become
operational:
-* `pysnmp <https://pypi.python.org/pypi/pysnmp/>`_,
+* `pysnmp <https://pypi.org/project/pysnmp/>`_,
SNMP engine implementation
-* `pyasn1 <https://pypi.python.org/pypi/pyasn1>`_,
+* `pyasn1 <https://pypi.org/project/pyasn1/>`_,
used for handling ASN.1 objects
-* `pysmi <https://pypi.python.org/pypi/pysmi/>`_ for automatic
+* `pysmi <https://pypi.org/project/pysmi/>`_ for automatic
MIB download and compilation. That helps visualizing more SNMP objects
Optional:
-* `pysnmpcrypto <https://pypi.python.org/pypi/pysnmpcrypto/>`_,
+* `pysnmpcrypto <https://pypi.org/project/pysnmpcrypto/>`_,
for strong SNMPv3 crypto support
The installation procedure for all the above packages is as follows
diff --git a/pysnmp/carrier/asyncio/dgram/base.py b/pysnmp/carrier/asyncio/dgram/base.py
index 886f8801..a819a9c9 100644
--- a/pysnmp/carrier/asyncio/dgram/base.py
+++ b/pysnmp/carrier/asyncio/dgram/base.py
@@ -31,6 +31,7 @@
# THE POSSIBILITY OF SUCH DAMAGE.
#
import sys
+import platform
import traceback
from pysnmp.carrier.asyncio.base import AbstractAsyncioTransport
from pysnmp.carrier import error
@@ -77,13 +78,20 @@ class DgramAsyncioProtocol(asyncio.DatagramProtocol, AbstractAsyncioTransport):
debug.logger & debug.flagIO and debug.logger('connection_lost: invoked')
# AbstractAsyncioTransport API
-
+
+ python344 = platform.python_version_tuple() >= ('3', '4', '4')
+
def openClientMode(self, iface=None):
try:
c = self.loop.create_datagram_endpoint(
lambda: self, local_addr=iface, family=self.sockFamily
)
- self._lport = asyncio.async(c)
+ # Avoid deprecation warning for asyncio.async()
+ if python344:
+ self._lport = asyncio.ensure_future(c)
+ else: # pragma: no cover
+ self._lport = asyncio.async(c)
+
except Exception:
raise error.CarrierError(';'.join(traceback.format_exception(*sys.exc_info())))
return self
diff --git a/pysnmp/carrier/asyncio/dispatch.py b/pysnmp/carrier/asyncio/dispatch.py
index d45fdb6b..4fbafd1a 100644
--- a/pysnmp/carrier/asyncio/dispatch.py
+++ b/pysnmp/carrier/asyncio/dispatch.py
@@ -31,6 +31,7 @@
# THE POSSIBILITY OF SUCH DAMAGE.
#
import sys
+import platform
import traceback
from pysnmp.carrier.base import AbstractTransportDispatcher
from pysnmp.error import PySnmpError
@@ -40,6 +41,7 @@ try:
except ImportError:
import trollius as asyncio
+python344 = platform.python_version_tuple() >= ('3', '4', '4')
class AsyncioDispatcher(AbstractTransportDispatcher):
"""AsyncioDispatcher based on asyncio event loop"""
@@ -66,10 +68,14 @@ class AsyncioDispatcher(AbstractTransportDispatcher):
raise
except Exception:
raise PySnmpError(';'.join(traceback.format_exception(*sys.exc_info())))
-
+
def registerTransport(self, tDomain, transport):
if self.loopingcall is None and self.getTimerResolution() > 0:
- self.loopingcall = asyncio.async(self.handle_timeout())
+ # Avoid deprecation warning for asyncio.async()
+ if python344:
+ self.loopingcall = asyncio.ensure_future(self.handle_timeout())
+ else: # pragma: no cover
+ self.loopingcall = asyncio.async(self.handle_timeout())
AbstractTransportDispatcher.registerTransport(
self, tDomain, transport
)