Fixed possible bug related to having multiple instances of
authorMarek Marecki <triviuss@gmail.com>
Sun, 7 Jul 2013 12:49:20 +0000 (14:49 +0200)
committerMarek Marecki <triviuss@gmail.com>
Sun, 7 Jul 2013 12:49:20 +0000 (14:49 +0200)
`Connection()` and `User()` in one script

diaspy/connection.py
diaspy/people.py
diaspy/streams.py

index 9ce40570e69f628b7fb3a8fc395ed76d40d79592..ccc167bc6552ff7140fa6b2859954437f5f26c61 100644 (file)
@@ -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:
index 0e15076ee513da01d91f57c33b82e6b6aad0ab36..0a73657bf823e23a9b43e112e59f61414e8281e9 100644 (file)
@@ -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,
index 2a3c233750067df39f845dad204cbcfb398275fc..4a0ec19d75d77e9a9d9bdae83e1315226935f9c1 100644 (file)
@@ -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()