From 6cd1bae0c1d8a2afef5207e865c7001193670b2d Mon Sep 17 00:00:00 2001 From: Marek Marecki Date: Sun, 7 Jul 2013 14:49:20 +0200 Subject: [PATCH] Fixed possible bug related to having multiple instances of `Connection()` and `User()` in one script --- diaspy/connection.py | 4 ++-- diaspy/people.py | 4 +--- diaspy/streams.py | 2 +- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/diaspy/connection.py b/diaspy/connection.py index 9ce4057..ccc167b 100644 --- a/diaspy/connection.py +++ b/diaspy/connection.py @@ -24,8 +24,6 @@ class Connection(): """ _token_regex = re.compile(r'content="(.*?)"\s+name="csrf-token') _userinfo_regex = re.compile(r'window.current_user_attributes = ({.*})') - login_data = {} - token = '' def __init__(self, pod, username='', password=''): """ @@ -38,6 +36,8 @@ class Connection(): """ self.pod = pod self.session = requests.Session() + self.login_data = {} + self.token = '' try: self._setlogin(username, password) except Exception as e: diff --git a/diaspy/people.py b/diaspy/people.py index 0e15076..0a73657 100644 --- a/diaspy/people.py +++ b/diaspy/people.py @@ -24,11 +24,9 @@ class User(): optional parameters. GUID takes precedence over handle when fetching user stream. When fetching user data, handle is required. """ - data = {} - stream = [] - def __init__(self, connection, guid='', handle='', fetch='posts', id=0): self._connection = connection + self.stream = [] self.data = { 'guid': guid, 'handle': handle, diff --git a/diaspy/streams.py b/diaspy/streams.py index 2a3c233..4a0ec19 100644 --- a/diaspy/streams.py +++ b/diaspy/streams.py @@ -376,5 +376,5 @@ class Tag(Generic): :type tag: str """ self._connection = connection - self._location = 'tags/{0}'.format(tag) + self._location = 'tags/{0}.json'.format(tag) self.fill() -- 2.25.1