From 5d4e27dc0776fd04d8a67dfd0f8cd9a51cbec4cc Mon Sep 17 00:00:00 2001 From: Navan Chauhan Date: Sun, 26 May 2019 18:18:28 +0530 Subject: Created Python Folder --- function-specific-programs/tweet.py | 43 ------------------------------------- 1 file changed, 43 deletions(-) delete mode 100644 function-specific-programs/tweet.py (limited to 'function-specific-programs/tweet.py') diff --git a/function-specific-programs/tweet.py b/function-specific-programs/tweet.py deleted file mode 100644 index 9903edd..0000000 --- a/function-specific-programs/tweet.py +++ /dev/null @@ -1,43 +0,0 @@ -""" -import tweepy - -#twitter application credentials -consumer_key="addYours" -consumer_secret="addYours" - -#twitter user credentials -access_token="AddYours" -access_token_secret="AddYours" - -auth = tweepy.OAuthHandler(consumer_key, consumer_secret) -auth.set_access_token(access_token, access_token_secret) - -tweepyapi = tweepy.API(auth) - -tweepyapi.update_status('Hello World!') -print("Hello " + tweepyapi.me().name) -""" - -import tweepy - -def get_api(cfg): - auth = tweepy.OAuthHandler(cfg['consumer_key'], cfg['consumer_secret']) - auth.set_access_token(cfg['access_token'], cfg['access_token_secret']) - return tweepy.API(auth) - -def main(): - # Fill in the values noted in previous step here - cfg = { - "consumer_key" : consumer_key, - "consumer_secret" : consumer_secret, - "access_token" : access_token, - "access_token_secret" : access_token_secret - } - - api = get_api(cfg) - tweet = "Hello, world!" - status = api.update_status(status=tweet) - # Yes, tweet is called 'status' rather confusing - -if __name__ == "__main__": - main() -- cgit v1.2.3