def deletePost():
    u=username.get()
    p=pas.get()
    bot=Bot()
    bot.login(username=u,password=p)
    medias=bot.get_total_user_medias(bot.user_id)

    for media in medias:
        try:
            bot.delete_media(media)
            time.sleep(random.randrange(7,12)) #Random post delete time 
        except:
            print("Hata")
            time.sleep(random.randrange(100,200))
from instabot import Bot
import userins
import time
med = Bot()
med.login(username=userins.username, password=userins.password)
medias = med.get_total_user_medias(med.user_id)

for media in medias:
    try:
        med.delete_media(media)
        time.sleep(5)
        print("Delete Succesful!")
    except:
        print("No such post exists")
        time.sleep(10)