-
Notifications
You must be signed in to change notification settings - Fork 0
/
stockmarket-Copy1.py
53 lines (26 loc) · 988 Bytes
/
stockmarket-Copy1.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/usr/bin/env python
# coding: utf-8
# In[1]:
import tweepy
import csv
import pandas as pd
# In[2]:
consumer_key = 'd7bw4FdO2UKG42xqtpnLolJon'
consumer_secret = 'cwIGwLkkJkvL2mOUiTKrB2ogA5KqvWaMvgRNvzpx2TnGJ6ZUsx'
access_token = '777394875964678145-7TlPRYvlVB9KKJJx3ZJFeMoWgxcLpXN'
access_token_secret = 'm4GxM6D8FE7IXqj2Xf6PIS8RH0kjltPaCLCcezMxGtaFX'
# In[3]:
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="#mutual",count=100,
lang="en",
since="2018-02-16").items():
print (tweet.created_at, tweet.text)
csvWriter.writerow([tweet.created_at, tweet.text.encode('utf-8')])
# In[ ]:
# In[ ]:
# In[ ]: