Skip to content

Instantly share code, notes, and snippets.

@vickyqian
Last active May 11, 2024 16:19
Show Gist options
  • Save vickyqian/f70e9ab3910c7c290d9d715491cde44c to your computer and use it in GitHub Desktop.
Save vickyqian/f70e9ab3910c7c290d9d715491cde44c to your computer and use it in GitHub Desktop.

Revisions

  1. vickyqian renamed this gist Apr 26, 2017. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  2. vickyqian revised this gist Apr 26, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -18,6 +18,6 @@ csvWriter = csv.writer(csvFile)

    for tweet in tweepy.Cursor(api.search,q="#unitedAIRLINES",count=100,
    lang="en",
    since_id="2017-04-03").items():
    since="2017-04-03").items():
    print (tweet.created_at, tweet.text)
    csvWriter.writerow([tweet.created_at, tweet.text.encode('utf-8')])
  3. vickyqian revised this gist Apr 26, 2017. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,7 @@
    import tweepy
    import csv
    import pandas as pd
    ####input your credentials here
    consumer_key = ''
    consumer_secret = ''
    access_token = ''
  4. vickyqian created this gist Apr 14, 2017.
    22 changes: 22 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,22 @@
    import tweepy
    import csv
    import pandas as pd
    consumer_key = ''
    consumer_secret = ''
    access_token = ''
    access_token_secret = ''

    auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
    auth.set_access_token(access_token, access_token_secret)
    api = tweepy.API(auth,wait_on_rate_limit=True)
    #####United Airlines
    # Open/Create a file to append data
    csvFile = open('ua.csv', 'a')
    #Use csv Writer
    csvWriter = csv.writer(csvFile)

    for tweet in tweepy.Cursor(api.search,q="#unitedAIRLINES",count=100,
    lang="en",
    since_id="2017-04-03").items():
    print (tweet.created_at, tweet.text)
    csvWriter.writerow([tweet.created_at, tweet.text.encode('utf-8')])