Skip to content

Commit

Permalink
udating README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
surya-veer committed Jan 20, 2018
0 parents commit 4826e7d
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 0 deletions.
37 changes: 37 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# TwitterBot
This is the simplest twitter bot for retweet.

## Dependencies
**```tweepy```**<br>
install via pip<br>
```sudo pip install tweepy```

## How to use
1. First create App on twitter.<br>
Visit: http://apps.twitter.com <br>
**You need a twiter account for this.**

2. Generate **consumer_key, consumer_secret, access_token, access_token_secret**.
3. Download ```retweet.py``` form my repository.
4. Now exit ```retweet.py``` and enter your **consumer_key, consumer_secret, access_token, access_token_secret** in this script.
5. Finally run **retweet.py**

## How to edit ```retweet.py```
You can increase ```hash_tag``` in **hast_tag** for retweets.<br>
Example: <br>
hash_tag = ['exmaple']<br>
edit: <br>
hash_tag = ['example','example2']<br>
Now ```for``` loop will automatically itrate ```hash_tag```




### Please commit for any changes or bugs :)







29 changes: 29 additions & 0 deletions retweet.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@

import tweepy
import time

consumer_key = '8ROBF6oXfqKojxSGSPQn9bjBC'
consumer_secret = 'TG8IZiVVsWkAvAW0IuWi7UvQVP4Spkmdh4NawVxpReJQzUfrcM'
access_token = '3241977882-vC0oeIcjrBIU7oRjWLxy3hU35ntsuU7XNBPXWQN'
access_token_secret = 'Xkyzls3T0rD2T5l67o3hMfyQkGWFRzgZYH9Wnkp92m7iO'

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

hash_tags = ['#IIT_indore','#not_so_prestigious','#bhookhLagiHai ']

for query in hash_tags:
for tweet in tweepy.Cursor(api.search, q=query).items(5):
try:
print('\nTweet by @' + tweet.user.screen_name)
print('Attempting to retweet')

tweet.retweet()
print('Retweet published successfully.')
time.sleep(10)
except tweepy.TweepError as error:
print('\nError. Retweet not successful. Reason: ')
print(error.reason)
except StopIteration:
break

0 comments on commit 4826e7d

Please sign in to comment.