How I got rid of my 1500+ tweets within 7 minutes!

This is my very first blog post. Let me introduce myself first. I am Aman Mahajan, who graduated recently from Netaji Subhas Institute of Technology in June 2017. I am currently working at Expedia ,Gurgaon Office as an Assoc. Software Development Engineer.

Motivation Behind this?

So just like everyone I used Facebook as my primary social network. Posted sometimes, very rare but yes it was some authentic and useful content. Sometimes pics too :p . But as usual I had this habit participating on various online competitions where they give you various prizes for answering some questions or just sharing their post. But I hesitated to do that on fb. So now what to do? Voila, twitter comes to the rescue. Spamming ,spamming daily ,retweeting, sharing links what not. Tweeting lots about cricket too! All this led to 1k useless tweets which I now realised were useless 😆 . Just got up one day decided to delete my account and start posting something useful which I do daily during my job. But wait, starting a different account means follow everyone again, gain followers again, update twitter hyperlinks everyone. Damn, this was tedious. Ok, why not delete all the tweets? Wait a minute they were a 1000+ tweets and I am definitely not a robot. What to do? Twitter API? YES!

Started looking into the docs and got what I needed to use within 10 minutes. Decided to do proceed in Flask. Don’t ask me why 😜.

Got stuck during twitter login but figured it out later. Mind you this was my first twitter app.

And finally the showstopper :

Opened a dummy account posted 3–4 tweets with hashtags and what not and everything was working like a charm.

So now was the time for the movie to release. Opened home (localhost:8080/twitter) and entered my original credentials and went out for a drink. Came back and to my surprise not a single tweet was deleted.

Damn!

Debugging………………

And then finally an hour later I realised my mistake. My first tweet had an emoji due to which twitter was returning me a unicode character which python was throwing exception. Finally fixed it and started again and this time decided to watch terminal till the end. Again entered my credentials and then my terminal looked something like this :

Just loved all this. Took a lot more time than I expected around 7 minutes. And finally when I switched to my browser it showed me this response :

{“Deleted tweets”: 1567,”response”: ”true”}

Really delighted to see this.

And why worry when the code is here . Feel free to raise issues and contribute.

And here is my twitter account. See for yourself ✋.

Thanks for reading.

Feel free to contact me (maybe twitter 😛).