Ejemplo n.º 1
0
                    'StringValue': meta["user"]["location"] or " ",
                    'DataType': 'String'
                },
            }

            queue.send_message(MessageBody= meta["text"], MessageAttributes=tweetAttr)
            print(meta["user"]["name"])

            return True
    except Exception as e:
        print(e)
    return False


if __name__ == "__main__":
    stream = TweepyStream(upload_tweet_with_geo).stream
    trackList = []
    print("Enter keywords for tracking followed by a newline to begin. \
            You will use the default track list if no keyword is entered. ")
    while True:
        keyword = input()
        if keyword == "": break
        trackList.append(keyword)
    if len(trackList) == 0:
        trackList = ['concert', 'trip', 'running', 'party']
    print("Start tracking", trackList)
    #ref: https://dev.twitter.com/streaming/overview/request-parameters
    stream.filter(track = trackList, languages = ['en'])
    """
Hillary Clinton
Bernie Sanders
Ejemplo n.º 2
0
        print("line:", len(line))

        if upload_tweet_with_geo(line[:-1]):
            num += 1
            if num == nrecord:
                break
        # sleep(1)


if __name__ == "__main__":
    if opt.start > 0:
        upload_tweet_file(opt.filename, opt.start, opt.nrecord)
    elif opt.start == 0:
        from tweepyStream import TweepyStream

        stream = TweepyStream(upload_tweet_with_geo).stream
        trackList = ["concert", "trip", "running", "party"]
        print("Enter keywords to track followed by a blank line.")
        while True:
            keyword = input()
            if keyword == "":
                break
            trackList.append(keyword)
        print("Start tracking", trackList)
        stream.filter(track=trackList)
        """
Hillary Clinton
Bernie Sanders
Donald Trump
Ted Cruz
John Kasich
Ejemplo n.º 3
0
        if count < start: continue
        print('line:',len(line))

        if upload_tweet_with_geo(line[:-1]):
            num += 1
            if num == nrecord: break
        #sleep(1)



if __name__ == "__main__":
    if opt.start > 0:
        upload_tweet_file(opt.filename, opt.start, opt.nrecord)
    elif opt.start == 0:
        from tweepyStream import TweepyStream
        stream = TweepyStream(upload_tweet_with_geo).stream
        trackList = ['concert', 'trip', 'running', 'party']
        print("Enter keywords to track followed by a blank line.")
        while True:
            keyword = input()
            if keyword == "": break
            trackList.append(keyword)
        print("Start tracking", trackList)
        stream.filter(track = trackList)
        """
Hillary Clinton
Bernie Sanders
Donald Trump
Ted Cruz
John Kasich
Gary Johnson