From 75fcdd7d4548da69542307499c9d4e177e3f0331 Mon Sep 17 00:00:00 2001 From: Marek Marecki Date: Sat, 11 May 2013 07:08:57 +0200 Subject: [PATCH] CHanges in `Connection()` (medium-sized) and `Stream()` (extra small) --- diaspy/connection.py | 14 ++------------ diaspy/streams.py | 7 +++---- 2 files changed, 5 insertions(+), 16 deletions(-) diff --git a/diaspy/connection.py b/diaspy/connection.py index 772e95a..a93c920 100644 --- a/diaspy/connection.py +++ b/diaspy/connection.py @@ -57,14 +57,7 @@ class Connection(): :type params: dict """ string = '{0}/{1}'.format(self.pod, string) - if headers and params: - request = self.session.post(string, data=data, headers=headers, params=params) - elif headers and not params: - request = self.session.post(string, data=data, headers=headers) - elif not headers and params: - request = self.session.post(string, data=data, params=params) - else: - request = self.session.post(string, data=data) + request = self.session.post(string, data, headers=headers, params=params) return request def delete(self, string, data, headers={}): @@ -78,10 +71,7 @@ class Connection(): :type headers: dict """ string = '{0}/{1}'.format(self.pod, string) - if headers: - request = self.session.delete(string, data=data, headers=headers) - else: - request = self.session.delete(string, data=data) + request = self.session.delete(string, data=data, headers=headers) return request def _setlogin(self, username, password): diff --git a/diaspy/streams.py b/diaspy/streams.py index 195882b..d01a0c0 100644 --- a/diaspy/streams.py +++ b/diaspy/streams.py @@ -57,16 +57,15 @@ class Generic: passing the desired one to the constructor. For example: - def _setlocation(self): - self._location = 'foo.json' - + def _setlocation(self): + self._location = 'foo.json' :param location: url of the stream :type location: str - :returns: str """ self._location = 'stream.json' + return self._location def _obtain(self): """Obtains stream from pod. -- 2.25.1