Revision c63dab4b490fdad9eef2fd7c65727fa3fcaeb8ca authored by Jeremy Low on 06 December 2015, 20:25:44 UTC, committed by Jeremy Low on 06 December 2015, 20:25:44 UTC
1 parent 7457f1e
Raw File
url.py
#!/usr/bin/env python

from twitter import TwitterError  # import not used


class Url(object):
    """A class representing an URL contained in a tweet"""

    def __init__(self,
                 url=None,
                 expanded_url=None):
        self.url = url
        self.expanded_url = expanded_url

    @staticmethod
    def NewFromJsonDict(data):
        """Create a new instance based on a JSON dict.

        Args:
          data:
            A JSON dict, as converted from the JSON in the twitter API

        Returns:
          A twitter.Url instance
        """
        return Url(url=data.get('url', None),
                   expanded_url=data.get('expanded_url', None))
back to top