質問編集履歴

1

コード修正

2018/06/19 04:24

投稿

ideee
ideee

スコア11

test CHANGED
@@ -1 +1 @@
1
- pythonでツイート検索キーワードでフォローしたい
1
+ tweepyでツイート検索キーワードでフォローしたいがエラーで出る
test CHANGED
@@ -2,9 +2,7 @@
2
2
 
3
3
 
4
4
 
5
- pythonでツイートの検索キーワードでファボ、フォローをしたいと思っています。
5
+ tweepyツイートの検索キーワードでフォローをしたい
6
-
7
- ファボはできのですが、
8
6
 
9
7
 
10
8
 
@@ -16,19 +14,9 @@
16
14
 
17
15
  Traceback (most recent call last):
18
16
 
19
- File "autoLike.py", line 27, in <module>
17
+ raise TweepError(error_msg, resp, api_code=api_error_code)
20
18
 
21
- api.create_favorite(user_id)
22
-
23
- File "  /tweepy/binder.py", line 250, in _call
24
-
25
- return method.execute()
26
-
27
- File "  /tweepy/binder.py", line 234, in execute
28
-
29
- raise TweepError(error_msg, resp, api_code=api_error_code)
30
-
31
- tweepy.error.TweepError: [{'code': 139, 'message': 'You have already favorited this status.'}]
19
+ tweepy.error.TweepError: [{'code': 108, 'message': 'Cannot find specified user.'}]
32
20
 
33
21
  ```
34
22
 
@@ -42,7 +30,7 @@
42
30
 
43
31
  import tweepy
44
32
 
45
-
33
+ import traceback
46
34
 
47
35
 
48
36
 
@@ -90,23 +78,15 @@
90
78
 
91
79
  print(time)
92
80
 
93
- #try:
81
+ try:
94
82
 
95
- api.create_favorite(user_id)
83
+ api.create_friendship(user_id)
96
84
 
97
- print(user)
85
+ print("をFollowしました")
98
86
 
99
- print("をLikeしました")
87
+ except :
100
88
 
101
- api.create_friendship(user_id)
89
+ traceback.print_exc()
102
-
103
- print("をFollowしました")
104
-
105
- #except:
106
-
107
- print("######################")
108
-
109
-
110
90
 
111
91
  ```
112
92
 
@@ -121,7 +101,3 @@
121
101
  Python 3.6.4
122
102
 
123
103
  tweepy 3.6.0
124
-
125
-
126
-
127
- try exceptはエラーをはきだすためにコメント化しました