def __init__(self, tweet: dict): self.contributors = list_obj_attr(tweet, 'contributors', Contributor) self.coordinates = obj_attr(tweet, 'coordinates', TweetCoordinates) self.created_at = datetime_attr(tweet, 'created_at') self.current_user_retweet = obj_attr(tweet, 'current_user_retweet', CurrentUserRetweet) self.entities = obj_attr(tweet, 'entities', Entities) self.favorite_count = int_attr(tweet, 'favorite_count') self.favorited = bool_attr(tweet, 'favorited') self.filter_level = str_attr(tweet, 'filter_level') self.geo = obj_attr(tweet, 'geo', Geo) # deprecated self.id_ = int_attr(tweet, 'id') self.in_reply_to_screen_name = int_attr(tweet, 'in_reply_to_screen_name') self.in_reply_to_status_id = int_attr(tweet, 'in_reply_to_status_id') self.in_reply_to_user_id = int_attr(tweet, 'in_reply_to_user_id') self.lang = str_attr(tweet, 'lang') self.place = obj_attr(tweet, 'place', Place) self.possibly_sensitive = bool_attr(tweet, 'possibly_sensitive') self.quoted_status_id = int_attr(tweet, 'quoted_status_id') self.quoted_status = obj_attr(tweet, 'quoted_status', type(self)) self.scopes = dict_attr(tweet, 'scopes') self.retweet_count = int_attr(tweet, 'retweet_count') self.retweeted = bool_attr(tweet, 'retweeted') self.retweeted_status = obj_attr(tweet, 'retweeted_status', type(self)) self.source = str_attr(tweet, 'source') self.text = str_attr(tweet, 'text') self.truncated = bool_attr(tweet, 'truncated') self.user = obj_attr(tweet, 'user', User) self.withheld_copyright = bool_attr(tweet, 'withheld_copyright') self.withheld_in_countries = list_str_attr(tweet, 'withheld_in_countries') self.withheld_scope = str_attr(tweet, 'withheld_scope')
def __init__(self, user: dict): self.contributors_enabled = bool_attr(user, 'contributors_enabled') self.created_at = datetime_attr(user, 'created_at') self.default_profile = bool_attr(user, 'default_profile') self.default_profile_image = bool_attr(user, 'default_profile_image') self.description = str_attr(user, 'description') self.entities = obj_attr(user, 'entities', UserEntities) self.favourites_count = int_attr(user, 'favourites_count') self.follow_request_sent = bool_attr(user, 'follow_request_sent') self.following = bool_attr(user, 'following') # deprecated self.followers_count = int_attr(user, 'followers_count') self.friends_count = int_attr(user, 'friends_count') self.geo_enabled = bool_attr(user, 'geo_enabled') self.has_extended_profile = bool_attr(user, 'has_extended_profile') self.id_ = int_attr(user, 'id') self.is_translation_enabled = bool_attr(user, 'is_translation_enabled') # not in docs self.is_translator = bool_attr(user, 'is_translator') self.lang = str_attr(user, 'lang') self.listed_count = int_attr(user, 'listed_count') self.location = str_attr(user, 'location') self.name = str_attr(user, 'name') self.notifications = bool_attr(user, 'notifications') # deprecated self.profile = UserProfile(user) self.protected = bool_attr(user, 'protected') self.screen_name = str_attr(user, 'screen_name') self.show_all_inline_media = bool_attr(user, 'show_all_inline_media') self.statuses_count = user['statuses_count'] self.time_zone = user['time_zone'] self.url = user['url'] self.utc_offset = user['utc_offset'] self.verified = user['verified']
def __init__(self, metadata: dict): self.completed_in = float_attr(metadata, 'completed_in') self.count = int_attr(metadata, 'count') self.max_id = int_attr(metadata, 'max_id') self.next_results = str_attr(metadata, 'next_results') self.query = str_attr(metadata, 'query') self.refresh_url = str_attr(metadata, 'refresh_url') self.since_id = int_attr(metadata, 'since_id')
def __init__(self, user: dict): self.background_color = str_attr(user, 'profile_background_color') self.background_image_url = str_attr(user, 'profile_background_image_url') self.background_image_url_https = str_attr( user, 'profile_background_image_url_https') self.background_tile = bool_attr(user, 'profile_background_tile') self.banner_url = str_attr(user, 'profile_banner_url') self.image_url = str_attr(user, 'profile_image_url') self.image_url_https = str_attr(user, 'profile_image_url_https') self.link_color = str_attr(user, 'profile_link_color') self.sidebar_border_color = str_attr(user, 'profile_sidebar_border_color') self.sidebar_fill_color = str_attr(user, 'profile_sidebar_fill_color') self.text_color = str_attr(user, 'profile_text_color') self.use_background_image = bool_attr(user, 'profile_use_background_image')
def __init__(self, media: dict): self.display_url = str_attr(media, 'display_url') self.expanded_url = str_attr(media, 'expanded_url') self.id_ = int_attr(media, 'id') self.indices = list_int_attr(media, 'indices') self.media_url = str_attr(media, 'media_url') self.media_url_https = str_attr(media, 'media_url_https') self.sizes = obj_attr(media, 'sizes', Sizes) # type: Sizes self.source_status_id = int_attr(media, 'source_status_id') self.type_ = str_attr(media, 'type') self.url = str_attr(media, 'url')
def __init__(self, place: dict): self.attributes = dict_attr(place, 'attributes') self.bounding_box = BoundingBox(place['bounding_box']) self.contained_within = place['contained_within'] self.country = place['country'] self.country_code = place['country_code'] self.full_name = place['full_name'] self.id_ = place['id'] self.name = place['name'] self.place_type = place['place_type'] self.url = place['url'] # may or may not exist: self.street_address = str_attr(place, 'street_address') self.locality = str_attr(place, 'locality') self.region = str_attr(place, 'region') self.iso3 = str_attr(place, 'iso3') self.postal_code = str_attr(place, 'postal_code') self.phone = str_attr(place, 'phone') self.twitter = str_attr(place, 'twitter') self.url = str_attr(place, 'url') self.app_id = str_attr( place, 'app:id') # TODO: this could also be a list of str
def __init__(self, metadata: dict): self.iso_language_code = str_attr(metadata, 'iso_language_code') self.result_type = str_attr(metadata, 'result_type')
def __init__(self, contributor: dict): self.id_ = int_attr(contributor, 'id') self.screen_name = str_attr(contributor, 'screen_name')
def __init__(self, user_mention: dict): self.id_ = int_attr(user_mention, 'id') self.indices = list_int_attr(user_mention, 'indices') self.name = str_attr(user_mention, 'name') self.screen_name = str_attr(user_mention, 'screen_name')
def __init__(self, url: dict): self.url = str_attr(url, 'url') self.expanded_url = str_attr(url, 'expanded_url') self.indices = list_int_attr(url, 'indices')
def __init__(self, hashtag: str): self.indices = list_int_attr(hashtag, 'indices') self.text = str_attr(hashtag, 'text')
def __init__(self, current_user_retweet: dict): self.id_ = str_attr(current_user_retweet, 'id')
def __init__(self, bounding_box: dict): self.coordinates = obj_attr(bounding_box, 'coordinates', BoundingBoxCoordinates) self.type_ = str_attr(bounding_box, 'type')
def __init__(self, location: dict): self.name = str_attr(location, 'name') self.woe_id = int_attr(location, 'woeid')
def __init__(self, size: dict): self.height = int_attr(size, 'h') self.width = int_attr(size, 'w') self.resize = str_attr(size, 'resize')
def __init__(self, coordinates: dict): self.coordinates = list_float_attr(coordinates, 'coordinates') self.type_ = str_attr(coordinates, 'type')