Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit3fc2562

Browse files
committed
added twitter api
1 parent9f035a6 commit3fc2562

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

‎21_twitter_bot.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
importtweepy
2+
3+
# Authentication credentials - dev.twitter.com
4+
cfg= {
5+
'consumer_key':'VALUE',
6+
'consumer_secret':'VALUE',
7+
'access_token':'VALUE',
8+
'access_token_secret':'VALUE'
9+
}
10+
11+
12+
defget_api_handler(cfg):
13+
auth=tweepy.OAuthHandler(cfg['consumer_key'],cfg['consumer_secret'])
14+
auth.set_access_token(cfg['access_token'],cfg['access_token_secret'])
15+
returntweepy.API(auth)
16+
17+
18+
defmain():
19+
api=get_api_handler(cfg)
20+
tweet='Hello, world from Tweepy!'
21+
api.update_status(status=tweet)
22+
23+
24+
if__name__=="__main__":
25+
main()

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp