コード例 #1
0
 def getTweetsFromList(owner_screen_name=None,
                       slug=None,
                       owner_id=None,
                       list_id=None,
                       since_id=None,
                       max_id=None,
                       count=None,
                       include_rts=None,
                       Access: _WeakAccess.WeakAccess = None):
     '''Reference: https://dev.twitter.com/docs/api/1.1/get/lists/statuses
      '''
     if (Access == None):
         Access = defaultAccess
     api = tweepy.API(Access.auth)
     resp = api.list_timeline(owner_screen_name=owner_screen_name,
                              slug=slug,
                              owner_id=owner_id,
                              list_id=list_id,
                              since_id=since_id,
                              max_id=max_id,
                              count=count,
                              include_rts=include_rts)
     lista = list()
     for tweet in resp:
         lista.append(_Tweet.Tweet(dictionary=tweet))
     return lista
コード例 #2
0
 def getTweet(id, Access: _WeakAccess.WeakAccess = None):
     '''Reference https://dev.twitter.com/rest/reference/get/statuses/show/%3Aid
      '''
     if (Access == None):
         Access = defaultAccess
     api = tweepy.API(Access.auth)
     return _Tweet.Tweet(dictionary=api.get_status(id=id))
コード例 #3
0
 def postFavoriteTweetCreate(id, Access: _StrongAccess.StrongAccess = None):
     ''' :reference:https://dev.twitter.com/rest/reference/post/favorites/create
      '''
     from SolTw import _Tweet
     if (Access == None):
         Access = defaultAccess
     api = tweepy.API(Access.auth)
     return _Tweet.Tweet(dictionary=api.create_favorite(id=id))
コード例 #4
0
 def getFavorites(user, page=0, Access: _WeakAccess.WeakAccess = None):
     '''Reference: https://dev.twitter.com/rest/reference/get/favorites/list
      '''
     if (Access == None):
         Access = defaultAccess
     api = tweepy.API(Access.auth)
     resp = api.favorites(id=user, page=page)
     lista = list()
     for u in resp:
         lista.append(_Tweet.Tweet(dictionary=u))
     return lista
コード例 #5
0
 def getRetweetsFromTweet(id,
                          Access: _WeakAccess.WeakAccess = None,
                          count=None):
     '''Reference https://dev.twitter.com/rest/reference/get/statuses/retweets/%3Aid
      '''
     if (Access == None):
         Access = defaultAccess
     api = tweepy.API(Access.auth)
     tweets = api.retweets(id=id, count=count)
     lista = list()
     for tweet in tweets:
         lista.append(_Tweet.Tweet(dictionary=tweet))
     return lista
コード例 #6
0
 def getMentionsTimelineFromUser(Access: _StrongAccess.StrongAccess = None,
                                 count=None,
                                 since_id=None,
                                 max_id=None):
     '''
         Reference: https://dev.twitter.com/rest/reference/get/statuses/mentions_timeline
     '''
     if (Access == None):
         Access = defaultAccess
     api = tweepy.API(Access.auth)
     mentions = api.mentions_timeline(count=count,
                                      since_id=since_id,
                                      max_id=max_id)
     lista = list()
     for mention in mentions:
         lista.append(_Tweet.Tweet(dictionary=mention))
     return lista
コード例 #7
0
 def postReply(id,
               msg,
               latitude=None,
               longitude=None,
               place_id=None,
               Access: _StrongAccess.StrongAccess = None):
     """ :reference: https://dev.twitter.com/rest/reference/post/statuses/update
         :allowed_param:'status', 'in_reply_to_status_id', 'lat', 'long', 'source', 'place_id', 'display_coordinates', 'media_ids'
      """
     if (Access == None):
         Access = defaultAccess
     api = tweepy.API(Access.auth)
     resp = api.update_status(in_reply_to_status_id=id,
                              lat=latitude,
                              long=longitude,
                              status=msg,
                              place_id=place_id)
     return _Tweet.Tweet(dictionary=resp.__dictt__())
コード例 #8
0
 def getHomeTimelineFromUser(Access: _StrongAccess.StrongAccess = None,
                             id=id,
                             count=None,
                             since_id=None,
                             max_id=None):
     '''
         Reference: https://dev.twitter.com/rest/reference/get/statuses/home_timeline
      '''
     if (Access == None):
         Access = defaultAccess
     api = tweepy.API(Access.auth)
     tweets = api.home_timeline(user_id=id,
                                count=count,
                                since_id=since_id,
                                max_id=max_id)
     lista = list()
     for tweet in tweets:
         lista.append(_Tweet.Tweet(dictionary=tweet))
     return lista
コード例 #9
0
 def getTimelineFromUser(username,
                         Access: _WeakAccess.WeakAccess = None,
                         count=None,
                         since_id=None,
                         max_id=None,
                         include_rts=False):
     '''
      Reference https://dev.twitter.com/rest/reference/get/statuses/user_timeline
      '''
     if (Access == None):
         Access = defaultAccess
     api = tweepy.API(Access.auth)
     lista = list()
     tweets = api.user_timeline(screen_name=username,
                                count=count,
                                since_id=since_id,
                                max_id=max_id,
                                include_rts=include_rts)
     for tweet in tweets:
         lista.append(_Tweet.Tweet(dictionary=tweet))
     return lista
コード例 #10
0
 def getMultipleTweet(ids: list,
                      Access: _WeakAccess.WeakAccess = None,
                      include_entities=None,
                      trim_user=None,
                      map=None):
     '''https://dev.twitter.com/rest/reference/get/statuses/lookup
      '''
     if (Access == None):
         Access = defaultAccess
     string = ""
     for id in ids:
         string += str(id) + ","
     api = tweepy.API(Access.auth)
     tweets = api._statuses_lookup(id=string,
                                   include_entities=include_entities,
                                   trim_user=trim_user,
                                   map=map)
     lista = list()
     for tweet in tweets:
         lista.append(_Tweet.Tweet(dictionary=tweet))
     return lista
コード例 #11
0
 def searchTweets(q,
                  Access: _WeakAccess.WeakAccess = None,
                  lang=None,
                  locale=None,
                  since_id=None,
                  geocode=None,
                  max_id=None,
                  since=None,
                  until=None,
                  result_type=None,
                  count=None,
                  include_entities=None,
                  from_=None,
                  to=None,
                  source=None):
     '''Reference: reference: https://dev.twitter.com/rest/reference/get/search/tweets
     '''
     if (Access == None):
         Access = defaultAccess
     api = tweepy.API(Access.auth)
     messages = api.search(q=q,
                           lang=lang,
                           locale=locale,
                           since_id=since_id,
                           geocode=geocode,
                           max_id=max_id,
                           since=since,
                           until=until,
                           result_type=result_type,
                           count=count,
                           include_entities=include_entities,
                           to=to,
                           source=source)
     lista = list()
     for m in messages:
         lista.append(_Tweet.Tweet(dictionary=m))
     return lista
コード例 #12
0
ファイル: _TwitterUser.py プロジェクト: granpk/SOL
 def __init__(self, id="", dictionary=dict()):
     dictionary = _Utils.CastToDictionary(dictionary)
     dictionary = _Utils.removeEmptyFields(dictionary)
     self.contributors_enabled = ""
     self.created_at = ""
     self.default_profile = ""
     self.default_profile_image = ""
     self.description = ""
     self.entities = ""
     self.favourites_count = ""
     self.follow_request_sent = ""
     self.following = ""
     self.followers_count = ""
     self.friends_count = ""
     self.geo_enabled = ""
     self.id = id
     self.id_str = ""
     self.is_translator = ""
     self.lang = ""
     self.listed_count = ""
     self.location = ""
     self.name = ""
     self.notifications = ""
     self.profile_background_color = ""
     self.profile_background_image_url = ""
     self.profile_background_image_url_https = ""
     self.profile_background_tile = ""
     self.profile_banner_url = ""
     self.profile_image_url = ""
     self.profile_image_url_https = ""
     self.profile_link_color = ""
     self.profile_sidebar_border_color = ""
     self.profile_sidebar_fill_color = ""
     self.profile_text_color = ""
     self.profile_use_background_image = ""
     self.protected = ""
     self.screen_name = ""
     self.show_all_inline_media = ""
     self.status = ""
     self.statuses_count = ""
     self.time_zone = ""
     self.url = ""
     self.utc_offset = ""
     self.verified = ""
     self.withheld_in_countries = ""
     self.withheld_scope = ""
     if ("contributors_enabled" in dictionary):
         self.contributors_enabled = dictionary["contributors_enabled"]
     if ("created_at" in dictionary):
         self.created_at = dictionary["created_at"]
     if ("default_profile" in dictionary):
         self.default_profile = dictionary["default_profile"]
     if ("default_profile_image" in dictionary):
         self.default_profile_image = dictionary["default_profile_image"]
     if ("description" in dictionary):
         self.description = dictionary["description"]
     if ("entities" in dictionary):
         self.entities = _Entity.Entity(dictionary=dictionary["entities"])
     if ("favourites_count" in dictionary):
         self.favourites_count = dictionary["favourites_count"]
     if ("follow_request_sent" in dictionary):
         self.follow_request_sent = dictionary["follow_request_sent"]
     if ("following" in dictionary):
         self.following = dictionary["following"]
     if ("followers_count" in dictionary):
         self.followers_count = dictionary["followers_count"]
     if ("friends_count" in dictionary):
         self.friends_count = dictionary["friends_count"]
     if ("geo_enabled" in dictionary):
         self.geo_enabled = dictionary["geo_enabled"]
     if ("id" in dictionary):
         self.id = dictionary["id"]
     if ("id_str" in dictionary):
         self.id_str = dictionary["id_str"]
     if ("is_translator" in dictionary):
         self.is_translator = dictionary["is_translator"]
     if ("lang" in dictionary):
         self.lang = dictionary["lang"]
     if ("listed_count" in dictionary):
         self.listed_count = dictionary["listed_count"]
     if ("location" in dictionary):
         self.location = dictionary["location"]
     if ("name" in dictionary):
         self.name = dictionary["name"]
     if ("notifications" in dictionary):
         self.notifications = dictionary["notifications"]
     if ("profile_background_color" in dictionary):
         self.profile_background_color = dictionary[
             "profile_background_color"]
     if ("profile_background_image_url" in dictionary):
         self.profile_background_image_url = dictionary[
             "profile_background_image_url"]
     if ("profile_background_image_url_https" in dictionary):
         self.profile_background_image_url_https = dictionary[
             "profile_background_image_url_https"]
     if ("profile_background_tile" in dictionary):
         self.profile_background_tile = dictionary[
             "profile_background_tile"]
     if ("profile_banner_url" in dictionary):
         self.profile_banner_url = dictionary["profile_banner_url"]
     if ("profile_image_url" in dictionary):
         self.profile_image_url = dictionary["profile_image_url"]
     if ("profile_image_url_https" in dictionary):
         self.profile_image_url_https = dictionary[
             "profile_image_url_https"]
     if ("profile_link_color" in dictionary):
         self.profile_link_color = dictionary["profile_link_color"]
     if ("profile_sidebar_border_color" in dictionary):
         self.profile_sidebar_border_color = dictionary[
             "profile_sidebar_border_color"]
     if ("profile_sidebar_fill_color" in dictionary):
         self.profile_sidebar_fill_color = dictionary[
             "profile_sidebar_fill_color"]
     if ("profile_text_color" in dictionary):
         self.profile_text_color = dictionary["profile_text_color"]
     if ("profile_use_background_image" in dictionary):
         self.profile_use_background_image = dictionary[
             "profile_use_background_image"]
     if ("protected" in dictionary):
         self.protected = dictionary["protected"]
     if ("screen_name" in dictionary):
         self.screen_name = dictionary["screen_name"]
     if ("show_all_inline_media" in dictionary):
         self.show_all_inline_media = dictionary["show_all_inline_media"]
     if ("status" in dictionary):
         self.status = _Tweet.Tweet(dictionary=dictionary["status"])
     if ("statuses_count" in dictionary):
         self.statuses_count = dictionary["statuses_count"]
     if ("time_zone" in dictionary):
         self.time_zone = dictionary["time_zone"]
     if ("url" in dictionary):
         self.url = dictionary["url"]
     if ("utc_offset" in dictionary):
         self.utc_offset = dictionary["utc_offset"]
     if ("verified" in dictionary):
         self.verified = dictionary["verified"]
     if ("withheld_in_countries" in dictionary):
         self.withheld_in_countries = dictionary["withheld_in_countries"]
     if ("withheld_scope" in dictionary):
         self.withheld_scope = dictionary["withheld_scope"]