Revision ff8be038cc78c23df6a95c1c94a2628d8ed4f0ec authored by Jeremy Low on 07 January 2016, 01:47:17 UTC, committed by Jeremy Low on 07 January 2016, 01:47:17 UTC
1 parent 2352858
Raw File
url.py
#!/usr/bin/env python


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