After reading the first post you might be thinking that the Bot we just made is not at all automated it is just an application to post tweets.
Don't be disappointed after reading this post you definitely will be able to automate your application.
If you are a unix/linux programmer you might very well about unix cron jobs that allows you to automate any command line program chronologically and thats the sole magic we are looking forward to right know.
First of edit your login.py file as follows:
Here as you can see what we did is that we created a list of post as twitter doesn't allow to post same tweet twice.
Now we will automate this login.py chronologically to post tweets in a timely manner.
Now start your unix system and goto terminal and do the following things:
1.) Type the following command:
crontab -e.
What this command does is it opens the editor for creating a cron job file in your /var/tmp folder.
2.) The basic format of your cron job has following syntax:
You find the reference here and here too
3.) Now I wanted to post a tweet each and every minute of everyday of every month and so on...So I edited my cron file as follows
Now enter the new line at the end of the file and close it.It will be auto
saved.
Here the last parameter shows the location of your login.py file.
4.) Alls well that ends well just check your twitter account for bots tweets
You can see my twitter page That has all the tweets posted by the bot.
And that concludes the complete tutorial for twitter bots using python.Thanks
And feel free to contact me for any related queries and feedback
Don't be disappointed after reading this post you definitely will be able to automate your application.
If you are a unix/linux programmer you might very well about unix cron jobs that allows you to automate any command line program chronologically and thats the sole magic we are looking forward to right know.
First of edit your login.py file as follows:
import twitter
import random as rm
a=['python with php ver1','python with php ver2','python with php ver3','python with php ver4','python with php ver5','python with php ver6','python with php ver7','python with php ver8','python with php ver9','python with php ver10']
api = twitter.Api(consumer_key='your_key',consumer_secret='your_key',access_token_key='your_key',access_token_secret='your_key')
status=api.PostUpdate(a[rm.randrange(1,10)])
print status.text
Here as you can see what we did is that we created a list of post as twitter doesn't allow to post same tweet twice.
Now we will automate this login.py chronologically to post tweets in a timely manner.
Now start your unix system and goto terminal and do the following things:
1.) Type the following command:
crontab -e.
What this command does is it opens the editor for creating a cron job file in your /var/tmp folder.
2.) The basic format of your cron job has following syntax:
minute hour day month day-of-week command-line-to-execute
This defines the timely format for running your scriptYou find the reference here and here too
3.) Now I wanted to post a tweet each and every minute of everyday of every month and so on...So I edited my cron file as follows
*/2 * * * * /usr/bin/python /home/maitray/htdocs/login.py
Now enter the new line at the end of the file and close it.It will be auto
saved.
Here the last parameter shows the location of your login.py file.
4.) Alls well that ends well just check your twitter account for bots tweets
You can see my twitter page That has all the tweets posted by the bot.
And that concludes the complete tutorial for twitter bots using python.Thanks
And feel free to contact me for any related queries and feedback
Ads : Auctions ,Electronics, Cars, Fashion, Collectibles, Coupons and Much More Online Shopping from eBay
www.ebay.com is a wonderful site that allows you to have a unique shopping experience
check out the auctions here
check out the auctions here