|
|
@ -116,6 +116,7 @@ class TwitterNetworkData(NetworkData): |
|
|
|
self.username = data['user']['screen_name'] |
|
|
|
self.username = data['user']['screen_name'] |
|
|
|
self.avatar = data['user']['profile_image_url'] |
|
|
|
self.avatar = data['user']['profile_image_url'] |
|
|
|
self.message_time = _to_datetime(data['created_at']) |
|
|
|
self.message_time = _to_datetime(data['created_at']) |
|
|
|
|
|
|
|
self.favourited = data['favorited'] |
|
|
|
|
|
|
|
|
|
|
|
if 'in_reply_to_status_id' in data and data['in_reply_to_status_id']: |
|
|
|
if 'in_reply_to_status_id' in data and data['in_reply_to_status_id']: |
|
|
|
self.parent = int(data['in_reply_to_status_id']) |
|
|
|
self.parent = int(data['in_reply_to_status_id']) |
|
|
@ -410,6 +411,16 @@ class Connection(NetworkBase): |
|
|
|
data = self._request(resource, body=body) |
|
|
|
data = self._request(resource, body=body) |
|
|
|
return TwitterNetworkData(data) |
|
|
|
return TwitterNetworkData(data) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def favourite(self, message): |
|
|
|
|
|
|
|
"""Mark a message as favourite.""" |
|
|
|
|
|
|
|
body = urllib.urlencode({'id': message.id}) |
|
|
|
|
|
|
|
if not message.favourite: |
|
|
|
|
|
|
|
resource = '/favorites/create/%d.json' % (message.id) |
|
|
|
|
|
|
|
else: |
|
|
|
|
|
|
|
resource = '/favorites/destroy/%d.json' % (message.id) |
|
|
|
|
|
|
|
data = self._request(resource, body=body) |
|
|
|
|
|
|
|
return TwitterNetworkData(data) |
|
|
|
|
|
|
|
|
|
|
|
def delete_message(self, message): |
|
|
|
def delete_message(self, message): |
|
|
|
"""Delete a message.""" |
|
|
|
"""Delete a message.""" |
|
|
|
if isinstance(message, NetworkData): |
|
|
|
if isinstance(message, NetworkData): |
|
|
@ -436,3 +447,8 @@ class Connection(NetworkBase): |
|
|
|
"""Twitter ignores retweets from the user.""" |
|
|
|
"""Twitter ignores retweets from the user.""" |
|
|
|
return not (message.username == |
|
|
|
return not (message.username == |
|
|
|
self._options[self.NAMESPACE]['username']) |
|
|
|
self._options[self.NAMESPACE]['username']) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def can_favourite(self, message): |
|
|
|
|
|
|
|
"""Always return True; Twitter allows favouriting/unfavouriting any |
|
|
|
|
|
|
|
messages.""" |
|
|
|
|
|
|
|
return True |
|
|
|