- class acscsv.twitter_acs.TwacsCSV(delim, options_keypath, options_geo, options_user, options_rules, options_urls, options_lang, options_influence, options_struct)[source]¶
Subset of Twitter fields with specified delimiter. Please see help for options
- get_output_list(d)[source]¶
Take a JSON Activity Streams payload as a Python dictionary. Specify the particular output fields (and their order) by constructing and returning a list of the desired extractor values. Default values for missing fields are set in the _Field class and can be overridden.
- procRecordToList(d)[source]¶
Take a JSON Activity Streams payload as a Python dictionary. Check activity for system information and compliance handling. If necessary, return the system info or compliance message. Otherwise, if the activity is valid, return the result of calling the appropriate output() method.
- class acscsv.snowflake.Snowflake(id)[source]¶
Snowflake id object provides access to multiple forms of of the bit fields present in a snowflake id. Ids can be of the form of a string with leading and trailing characters or symbols. The first 18 consecutive digits will be used as the id. It is also permitted to provide an int:
tag:search.twitter.com,2005:113733024721539072 113733024721539072 113733024721539072|This is the tweet for which you are looking|enwhere the latter represents a pre-snowflake twitter id. In this case all fields will be null.
When the input does not match a valid snowflake id, the input field is available as the id and all other fields are set to None.
Available fields:
id sequence worker data_center ts sample_set timestamp timeStruct timeString year month day hour min sec dow doy
- class acscsv.acscsv._Field(json_record)[source]¶
Base class for extracting the desired value at the end of a series of keys in a JSON Activity Streams payload. Set the application-wide default value (for e.g. missing values) here, but also use child classes to override when necessary. Subclasses also need to define the key-path (path) to the desired location by overwriting the path attr.
- fix_length(iterable, limit=None)[source]¶
Take an iterable (typically a list) and an optional maximum length (limit). If limit is not given, and the input iterable is not equal to self.default_value (typically “None”), the input iterable is returned. If limit is given, the return value is a list that is either truncated to the first limit items, or padded with self.default_value until it is of size limit. Note: strings are iterables, so if you pass this function a string, it will (optionally) truncate the number of characters in the string according to limit.
- class acscsv.acscsv._LimitedField(json_record, limit=1)[source]¶
Takes JSON record (in python dict form) and optionally a maximum length (limit, with default length=5). Uses parent class _Field() to assign the appropriate value to self.value. When self.value is a list of dictionaries, inheriting from _LimitedField() class allows for the extraction and combination of an arbitrary number of fields within self.value into self.value_list.
Ex: if your class would lead to having self.value = [ {‘a’: 1, ‘b’: 2, ‘c’: 3}, {‘a’: 4, ‘b’: 5, ‘c’: 6} ], and what you’d like is a list that looks like [ 1, 2, 4, 5 ], inheriting from _LimitedField() allows you to overwrite the fields list ( fields=[“a”, “b”] ) to obtain this result. Finally, self.value is set to a string representation of the final self.value_list.
- class acscsv.twitter_acs_fields.Field_activity_type(json_record)[source]¶
Take a dict, assign to self.value the appropriate value of Tweet, Retweet, or Reply. This class is being held onto for now, but may not be needed in future.
- class acscsv.twitter_acs_fields.Field_actor_displayname(json_record)[source]¶
Take a dict, assign to self.value the value of actor.displayName
- class acscsv.twitter_acs_fields.Field_actor_favoritesCount(json_record)[source]¶
Take a dict, assign to self.value the value of actor.favoritesCount
- class acscsv.twitter_acs_fields.Field_actor_followerscount(json_record)[source]¶
Take a dict, assign to self.value the value of actor.followersCount.
- class acscsv.twitter_acs_fields.Field_actor_friendscount(json_record)[source]¶
Take a dict, assign to self.value the value of actor.friendsCount.
- class acscsv.twitter_acs_fields.Field_actor_id(json_record)[source]¶
Take a dict, assign to self.value the numerical value of actor.id (after stripping off the leading ‘id:twitter...’ characters).
- class acscsv.twitter_acs_fields.Field_actor_image(json_record)[source]¶
Take a dict, assign to self.value the value of actor.image
- class acscsv.twitter_acs_fields.Field_actor_language(json_record)[source]¶
Take a dict, assign to self.value the first (currently only) value in the list at actor.languages
- class acscsv.twitter_acs_fields.Field_actor_link(json_record)[source]¶
Take a dict, assign to self.value the value of actor.link
- class acscsv.twitter_acs_fields.Field_actor_links(json_record)[source]¶
Take a dict, assign to self.value the list of dicts at actor.links
- class acscsv.twitter_acs_fields.Field_actor_listedcount(json_record)[source]¶
Take a dict, assign to self.value the value of actor.listedCount.
- class acscsv.twitter_acs_fields.Field_actor_location_displayname(json_record)[source]¶
Take a dict, assign to self.value the value of actor.location.displayName
- class acscsv.twitter_acs_fields.Field_actor_location_objecttype(json_record)[source]¶
Take a dict, assign to self.value the value of actor.location.objectType
- class acscsv.twitter_acs_fields.Field_actor_objecttype(json_record)[source]¶
Take a dict, assign to self.value the value of actor.objecttype
- class acscsv.twitter_acs_fields.Field_actor_postedtime(json_record)[source]¶
Take a dict, assign to self.value the value of actor.postedTime
- class acscsv.twitter_acs_fields.Field_actor_preferredusername(json_record)[source]¶
Take a dict, assign to self.value the value of actor.preferredUsername
- class acscsv.twitter_acs_fields.Field_actor_statusesCount(json_record)[source]¶
Take a dict, assign to self.value the value of actor.statusesCount
- class acscsv.twitter_acs_fields.Field_actor_summary(json_record)[source]¶
Take a dict, assign to self.value the value of actor.summary
- class acscsv.twitter_acs_fields.Field_actor_twittertimezone(json_record)[source]¶
Take a dict, assign to self.value the value of actor.twitterTimeZone
- class acscsv.twitter_acs_fields.Field_actor_utcoffset(json_record)[source]¶
Take a dict, assign to self.value the value of actor.utcOffset
- class acscsv.twitter_acs_fields.Field_actor_verified(json_record)[source]¶
Take a dict, assign to self.value a boolean repr of the value of actor.verified. Default value is False.
- class acscsv.twitter_acs_fields.Field_body(json_record)[source]¶
Take a dict, assign to self.value the value in top-level body key.
- class acscsv.twitter_acs_fields.Field_favoritescount(json_record)[source]¶
Take a dict, assign to self.value the value of top-level favoritesCount key.
- class acscsv.twitter_acs_fields.Field_generator_displayname(json_record)[source]¶
Take a dict, assign to self.value the value of generator.displayName key.
- class acscsv.twitter_acs_fields.Field_generator_link(json_record)[source]¶
Take a dict, assign to self.value the value of generator.link key.
- class acscsv.twitter_acs_fields.Field_geo_coordinates(json_record)[source]¶
Take a dict, assign to self.value the list at geo.coordinates. This is the coordinate pair of the user-enabled tweet geotag.
- class acscsv.twitter_acs_fields.Field_geo_type(json_record)[source]¶
Take a dict, assign to self.value the value of geo.type
- class acscsv.twitter_acs_fields.Field_gnip_klout_profile_klout_user_id(json_record)[source]¶
Take a dict, assign to self.value the value of gnip.klout_profile.klout_user_id
- class acscsv.twitter_acs_fields.Field_gnip_klout_profile_link(json_record)[source]¶
Take a dict, assign to self.value the value of gnip.klout_profile.link
- class acscsv.twitter_acs_fields.Field_gnip_klout_profile_topics(json_record)[source]¶
Take a dict, assign to self.value the list at gnip.klout_profile.topics
- class acscsv.twitter_acs_fields.Field_gnip_klout_score(json_record)[source]¶
Take a dict, assign to self.value the value of gnip.klout_score
- class acscsv.twitter_acs_fields.Field_gnip_language_value(json_record)[source]¶
Take a dict, assign to self.value the value of gnip.language.value
- class acscsv.twitter_acs_fields.Field_gnip_profilelocations_address_country(json_record)[source]¶
Take a dict, assign to self.value the value of gnip.profileLocations[0].address.country
- class acscsv.twitter_acs_fields.Field_gnip_profilelocations_address_countrycode(json_record)[source]¶
Take a dict, assign to self.value the value of gnip.profileLocations[0].address.countryCode
- class acscsv.twitter_acs_fields.Field_gnip_profilelocations_address_locality(json_record)[source]¶
Take a dict, assign to self.value the value of gnip.profileLocations[0].address.locality
- class acscsv.twitter_acs_fields.Field_gnip_profilelocations_address_region(json_record)[source]¶
Take a dict, assign to self.value the value of gnip.profileLocations[0].address.region
- class acscsv.twitter_acs_fields.Field_gnip_profilelocations_address_subregion(json_record)[source]¶
Take a dict, assign to self.value the value of gnip.profileLocations[0].address.subRegion
- class acscsv.twitter_acs_fields.Field_gnip_profilelocations_displayname(json_record)[source]¶
Take a dict, assign to self.value the value of gnip.profileLocations[0].displayName.
- class acscsv.twitter_acs_fields.Field_gnip_profilelocations_geo_coordinates(json_record)[source]¶
Take a dict, assign to self.value the value of gnip.profileLocations[0].geo.coordinates
- class acscsv.twitter_acs_fields.Field_gnip_profilelocations_geo_type(json_record)[source]¶
Take a dict, assign to self.value the value of gnip.profileLocations[0].geo.type
- class acscsv.twitter_acs_fields.Field_gnip_profilelocations_objecttype(json_record)[source]¶
Take a dict, assign to self.value the value of gnip.profileLocations[0].objectType
- class acscsv.twitter_acs_fields.Field_gnip_rules(json_record)[source]¶
Take a dict, assign to self.value the list of dicts at gnip.matching_rules
- class acscsv.twitter_acs_fields.Field_gnip_urls(json_record)[source]¶
Take a dict, assign to self.value the list of dicts at gnip.urls
- class acscsv.twitter_acs_fields.Field_id(json_record)[source]¶
Take a dict, assign to self.value the value in the top-level id key.
- class acscsv.twitter_acs_fields.Field_inreplyto_link(json_record)[source]¶
Take a dict, assign to self.value the value of inReplyTo.link. Should only appear in Replies.
- class acscsv.twitter_acs_fields.Field_link(json_record)[source]¶
Take a dict, assign to self.value the value in top-level link key.
- class acscsv.twitter_acs_fields.Field_location_country_code(json_record)[source]¶
Take a dict, assign to self.value the value of location.country_code.
- class acscsv.twitter_acs_fields.Field_location_displayname(json_record)[source]¶
Take a dict, assign to self.value the value of location.displayName
- class acscsv.twitter_acs_fields.Field_location_geo_coordinates(json_record)[source]¶
Take a dict, assign to self.value the list of coord pairs (vertices) in the value of location.geo.coordinates.
- class acscsv.twitter_acs_fields.Field_location_geo_type(json_record)[source]¶
Take a dict, assign to self.value the value of location.geo.type.
- class acscsv.twitter_acs_fields.Field_location_link(json_record)[source]¶
Take a dict, assign to self.value the value of location.link.
- class acscsv.twitter_acs_fields.Field_location_name(json_record)[source]¶
Take a dict, assign to self.value the value of location.name
- class acscsv.twitter_acs_fields.Field_location_objecttype(json_record)[source]¶
Take a dict, assign to self.value the value of location.objectType
- class acscsv.twitter_acs_fields.Field_location_twitter_country_code(json_record)[source]¶
Take a dict, assign to self.value the value of location.twitter_country_code.
- class acscsv.twitter_acs_fields.Field_object(json_record)[source]¶
Take a dict, assign to self.value the value in the top-level object key.
- class acscsv.twitter_acs_fields.Field_objecttype(json_record)[source]¶
Take a dict, assign to self.value the value in the top-level objectType key.
- class acscsv.twitter_acs_fields.Field_postedtime(json_record)[source]¶
Take a dict, assign to self.value the value in the top-level postedTime key. Timestamp is formatted according to input_fmt, which is set in the constructor.
- class acscsv.twitter_acs_fields.Field_provider_displayname(json_record)[source]¶
Take a dict, assign to self.value the value of provider.displayName key.
- class acscsv.twitter_acs_fields.Field_provider_link(json_record)[source]¶
Take a dict, assign to self.value the value of provider.link key.
- class acscsv.twitter_acs_fields.Field_provider_objecttype(json_record)[source]¶
Take a dict, assign to self.value the value of provider.objectType key.
- class acscsv.twitter_acs_fields.Field_retweetcount(json_record)[source]¶
Take a dict, assign to self.value the value of top-level retweetCount key.
Take a dict, assign to self.value the list of dicts at twitter_entities.hashtags
- class acscsv.twitter_acs_fields.Field_twitter_entities_media(json_record)[source]¶
Take a dict, assign to self.value the list of dicts at twitter_entities.media
- class acscsv.twitter_acs_fields.Field_twitter_entities_symbols(json_record)[source]¶
Take a dict, assign to self.value the list of dicts at twitter_entities.symbols
- class acscsv.twitter_acs_fields.Field_twitter_entities_urls(json_record)[source]¶
Take a dict, assign to self.value the list of dicts at twitter_entities.urls
- class acscsv.twitter_acs_fields.Field_twitter_entities_user_mentions(json_record)[source]¶
Take a dict, assign to self.value the list of dicts at twitter_entities.user_mentions
- class acscsv.twitter_acs_fields.Field_twitter_filter_level(json_record)[source]¶
Take a dict, assign to self.value the value of top-level twitter_filter_level key.