Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated version to support python versions above 3.8 #33

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
sudo: false
language: python
python:
- "3.5"
- "3.8"
install:
- pip install coveralls
script: "./uranium test"
Expand Down
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
aiographite
aiographite
===========

.. image:: https://travis-ci.org/zillow/aiographite.svg?branch=master
Expand Down
18 changes: 8 additions & 10 deletions aiographite/aiographite.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,14 @@ class AioGraphiteSendException(Exception):
class AIOGraphite:
"""
AIOGraphite is a Graphite client class, ultilizing asyncio,
designed to help Graphite users to send data into graphite easily.
designed to help Graphite users to send data into graphite easily.\

Removed loop parameter as it is removed from python 3.8 and above
"""

def __init__(self, graphite_server,
graphite_port=DEFAULT_GRAPHITE_PLAINTEXT_PORT,
protocol=PlaintextProtocol(), loop=None, timeout=None):
protocol=PlaintextProtocol(), timeout=None):
if not isinstance(protocol, (PlaintextProtocol, PickleProtocol)):
raise AioGraphiteSendException("Unsupported Protocol!")
self._graphite_server = graphite_server
Expand All @@ -43,7 +45,6 @@ def __init__(self, graphite_server,
self._reader, self._writer = None, None
self._timeout = timeout
self.protocol = protocol
self.loop = loop or asyncio.get_event_loop()

async def __aenter__(self):
await self._connect()
Expand Down Expand Up @@ -99,13 +100,10 @@ async def _connect(self) -> None:
try:
self._reader, self._writer = await asyncio.open_connection(
self._graphite_server,
self._graphite_port,
loop=self.loop)
except Exception:
raise AioGraphiteSendException(
"Unable to connect to the provided server address %s:%s"
% self._graphite_server_address
)
self._graphite_port)
except Exception as e:
raise AioGraphiteSendException(f"Unable to connect to the provided server address "
f"{self._graphite_server_address} due to {e}")

async def _disconnect(self) -> None:
"""
Expand Down
4 changes: 2 additions & 2 deletions environment.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
name: py35
name: py38
dependencies:
- python=3.5.1=0
- python=3.8.16=0