teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

1

2019/06/06 10:15

投稿

pentell
pentell

スコア40

title CHANGED
File without changes
body CHANGED
@@ -14,24 +14,30 @@
14
14
  ※ツイッターAPIの××××のみ任意のものに変更しています。
15
15
 
16
16
 
17
+ ```ここに言語を入力
17
18
  import tweepy
18
19
 
19
20
  def api():
21
+
22
+
20
- consumer_key = '××××'
23
+ consumer_key = '××××'
21
- consumer_secret = '××××'
24
+ consumer_secret = '××××'
22
- access_key = '××××'
25
+ access_key = '××××'
23
- access_secret = '××××'
26
+ access_secret = '××××'
24
-
27
+
25
- auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
28
+ auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
26
- auth.set_access_token(access_key, access_secret)
29
+ auth.set_access_token(access_key, access_secret)
27
- api = tweepy.API(auth)
30
+ api = tweepy.API(auth)
31
+
28
- return api
32
+ return api
33
+
29
-
34
+ dic={}
30
35
  for tweet in api().search('通貨'):
31
- text = tweet.text
36
+ text = tweet.text
32
- id = tweet.id
37
+ id = tweet.id
33
- dic.update({id:text})
38
+ dic.update({id:text})
34
- if '@' in dic[id]:
39
+ if '@' in dic[id]:
35
- pass
40
+ pass
36
- else:
41
+ else:
37
- api().create_favorite(id)
42
+ api().create_favorite(id)
43
+ ```