
import tweepy

consumer_key = ""
consumer_secret = ""

access_token = ""
access_token_secret = ""

auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
auth.set_access_token(access_token, access_token_secret)

api = tweepy.API(auth)

userid = str(input("Please input id who you want fav attack\n"))
count = input("input number you want to fav!\n")

fav = api.user_timeline(id = userid, count = count)

try:
    for status in fav:
        api.create_favorite(status.id_str)
except tweepy.error.TweepError as e:
    if e.args[0][0]['code'] == 139:
        print("You have already favorited this status! \n")
    else:
        print(e.reason)
finally:
    print("Done!")


import tweepy

consumer_key = ""
consumer_secret = ""

access_token = ""
access_token_secret = ""

auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
auth.set_access_token(access_token, access_token_secret)

api = tweepy.API(auth)

def getdata():
    userid = str(input("Please input id who you want fav attack\n"))
    count = input("input number you want to fav!\n")
    fav = api.user_timeline(id = userid, count = count)

def main():
    getdata()
    try:
        for status in fav:
            api.create_favorite(status.id_str)
    except tweepy.error.TweepError as e:
        if e.args[0][0]['code'] == 139:
            print("You have already favorited this status! \n")
        else:
            print(e.reason)
    finally:
            print("Done!")

if __name__ == "__main__":
    main()

Make it more complex (((
Make it more complex (((

  
  import tweepy
  
  consumer_key = ""
  consumer_secret = ""
  
  access_token = ""
  access_token_secret = ""
  
  auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
  auth.set_access_token(access_token, access_token_secret)
  
  api = tweepy.API(auth)
  
+ def getdata():
- userid = str(input("Please input id who you want fav attack\n"))
+     userid = str(input("Please input id who you want fav attack\n"))
- count = input("input number you want to fav!\n")
+     count = input("input number you want to fav!\n")
+     fav = api.user_timeline(id = userid, count = count)
  
- fav = api.user_timeline(id = userid, count = count)
+ def main():
+     getdata()
+     try:
+         for status in fav:
+             api.create_favorite(status.id_str)
+     except tweepy.error.TweepError as e:
+         if e.args[0][0]['code'] == 139:
+             print("You have already favorited this status! \n")
+         else:
+             print(e.reason)
+     finally:
+             print("Done!")
  
+ if __name__ == "__main__":
+     main()
- try:
-     for status in fav:
-         api.create_favorite(status.id_str)
- except tweepy.error.TweepError as e:
-     if e.args[0][0]['code'] == 139:
-         print("You have already favorited this status! \n")
-     else:
-         print(e.reason)
- finally:
-     print("Done!")
  
Make it more complex (((
## Code Before:

import tweepy

consumer_key = ""
consumer_secret = ""

access_token = ""
access_token_secret = ""

auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
auth.set_access_token(access_token, access_token_secret)

api = tweepy.API(auth)

userid = str(input("Please input id who you want fav attack\n"))
count = input("input number you want to fav!\n")

fav = api.user_timeline(id = userid, count = count)

try:
    for status in fav:
        api.create_favorite(status.id_str)
except tweepy.error.TweepError as e:
    if e.args[0][0]['code'] == 139:
        print("You have already favorited this status! \n")
    else:
        print(e.reason)
finally:
    print("Done!")

## Instruction:
Make it more complex (((
## Code After:

import tweepy

consumer_key = ""
consumer_secret = ""

access_token = ""
access_token_secret = ""

auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
auth.set_access_token(access_token, access_token_secret)

api = tweepy.API(auth)

def getdata():
    userid = str(input("Please input id who you want fav attack\n"))
    count = input("input number you want to fav!\n")
    fav = api.user_timeline(id = userid, count = count)

def main():
    getdata()
    try:
        for status in fav:
            api.create_favorite(status.id_str)
    except tweepy.error.TweepError as e:
        if e.args[0][0]['code'] == 139:
            print("You have already favorited this status! \n")
        else:
            print(e.reason)
    finally:
            print("Done!")

if __name__ == "__main__":
    main()
