Here is a screenshot of the Twitter Bot:
What is different this time, is that I wish to use AWS Lambda as the backend. I want to know what is required and what the workflow was. I wont repeat the steps Joel listed out in his tutorial, just some of the things I found out:
1. Seems that AWS Lambda wants the main file to be lambda_function.py and the main function to be lambda_handler(event, context).
2. The scheduling trigger is now "CloudWatch Events - Schedule" instead of just schedule.
3. I learned this from a friend that to always immediately put the credential file in .gitignore to avoid accidentally checking it in on GitHub.
echou$ cat .gitignore
*.pyc
credentials.json
I am now the proud owner of a Twitter Bot that searches for Cisco layoff news and retweet them. On this date of Aug. 19, 2016 that was the big news of the week.
https://twitter.com/Network4_Nerds
echou$
Here is what my code ended up as:
from __future__ import print_function
from twython import Twython
from twython.exceptions import TwythonError
import re
import json, pprint
with open('credentials.json') as f:
credentials = json.loads(f.read())
client = Twython(credentials["consumer_key"],
credentials["consumer_secret"],
credentials["access_token_key"],
credentials["access_token_secret"])
query = "cisco layoffs -filters:retweets"
rgx = r"cisco"
def lambda_handler(event, context):
results = client.search(q=query)
for tweet in results["statuses"]:
text = tweet["text"]
# re.search matches anywhere in the string; re.I means case-insensitive
if re.search(rgx, text, re.I):
print(tweet["text"])
# client.retweet will raise an error if we try to retweet a tweet
# that we've already retweeted. to avoid having to keep track, we
# just use a try/except block
try:
client.retweet(id=tweet["id"])
except TwythonError as e:
print(e)
results = client.search(q=query)
pprint.pprint(results)
Happy Coding!
That is very interesting; you are a very skilled blogger. I have shared your website in my social networks! A very nice guide. I will definitely follow these tips. Thank you for sharing such detailed article.
ReplyDeleteAws Online Training
Hi Eric,
DeleteNice to be visiting your blog again, it has been months for me. Well this article that i’ve been waited for so long.
I am a beginner in programming,started learning python a few days ago.When I was doing exercise,found a problem that I couldn't solve by myself.Could anyone help me about it?Thank you very much.
My python version is 3.6.3
the codes:
Python Code: (Double-click to select all)
1
2
3
4 name = ["aa", "bb", "cc", "dd"]
for zzz in (name):
name.remove(zzz)
print(name)
I wanted to delete or remove all values in the list,but the results always contain the values on the even places (like "bb" and "dd").
However,when I execute codes below:
Python Code: (Double-click to select all)
1
2
3 name = ["aa","bb","cc","dd"]
for zzz in (name):
print("hello, " + zzz)
I can get the results I want, printing every string with all the names in the list.
Is it because this function cannot use with remove function?
PEP 8 provides coding conventions for the Python code. It describes rules to adhere while coding in Python. This helps in better readability of code and thereby better understanding and easy maintainability. It covers from code indentation, amount of space to use for indentation, spaces v/s tabs for indentation, commenting, blank lines, maximum line length, way of importing files, etc.
It was cool to see your article pop up in my google search for the process yesterday. Great Guide.
Keep up the good work!
Ciao,
Hima
Updating ourselves to the latest technology is the good idea to live in this modern IT world. Reading articles like your blog this will make an encouraging power within me. Thanks for sharing such an informative content. AWS Training in Bangalore | Big Data Hadoop Training in Bangalore
ReplyDeleteAmazing Article, thank you!. I just wish to give you a big thumbs up for the excellent post. Kindly keep updating your blog. Java Developer is a dream career for IT students.To start wonderful Career to become a Java developer learn from Java Training in Chennai. or learn thru Java Online Training from India .
Deleteor Javascript Training in Chennai. Nowadays JavaScript has tons of job opportunities on various vertical industry.
This sites is known about the latest using programming languages and other supporting stuffs on the existing IT skills companies.
ReplyDeleteyou provide a very good information that is very useful for modern IT world. I gather lot of articles but this very nice one to read,They gave lot of new ideas for me.Thanks for sharing this valuable information.
ReplyDeletePython Online Training
Thanks for sharing this unique and informative post. This blog which provided me the required information. Software Testing Training in Chennai | Java Training in Chennai
ReplyDeleteThanks for sharing such a wonderful blog tableau training in bangalore
ReplyDeleteverygood blog helpful to everyone digital marketing courses in bangalore
ReplyDeleteexcellent blog hadoop training in bangalore
ReplyDeleteIt’s too informative blog and I am getting conglomerations of info’s about Python certification. Thanks for sharing,
ReplyDeletePython Training in Marathahalli
Java Training in Marathahalli
Nice blog AWS training in bangalore
ReplyDeleteHadoop training in bangalore
Tableau training in bangalore
PHP training in bangalore
Android training in bangalore
Digital marketing training in bangalore
useful blog iot training in bangalore
ReplyDeleteDevops Training in Bangalore
iteanz
ReplyDeletemachine learning training in bangalore
Nice Block On Network Automation
ReplyDeleteDevops Training
nice blog
ReplyDeletepython training in bangalore
Very nice post. Awesome article... Really helpful
ReplyDeleteGreat information. Thank you for sharing
ReplyDeleteThanks for sharing valuable information on Devops Online Training Hyderabad
ReplyDeletevery nice interview questions
ReplyDeletevlsi interview questions
extjs interview questions
laravel interview questions
sap bi/bw interview questions
pcb interview questions
unix shell scripting interview questions
really awesome blog
ReplyDeletehr interview questions
hibernate interview questions
selenium interview questions
c interview questions
c++ interview questions
linux interview questions
spring mvc interview questions
machine learning online training
servlet interview questions thanks for sharing
aws migration services
ReplyDeleteaws server migration service
aws migration services providers
Nice blog
ReplyDeletesap partner companies in bangalore
sap implementation companies in bangalore
sap partners in india
aws staffing
jquery interview questions
sql interview questions
I got nice blog
ReplyDeleteangular4 interview questions
python interview questions
artificial intelligence interview questions
python online training
artificial intelligence online training
Thank you for sharing this type of interview questions
ReplyDeleteIot Online Training
Itil Interview Questions
Salesforce Interview Questions
Msbi Interview questions
Salesforce Interview Questions
C Interview Questions
aws partners in bangalore
aws partners in india
aws service providers in india
aws service providers
Nice Blog
ReplyDeletesap partner companies in bangalore
sap implementation companies in bangalore
sap partners in india
aws staffing
Nice information
ReplyDeleteBest Online course
Free Online course
Online Training Course
aws,python,hadoop Online Training
aws,python,hadoop,Devops, data science,interview questions
Iteanz Technologies
I feel really happy to have seen your webpage and look forward to so
ReplyDeletemany more entertaining times reading here. Thanks once more for all
the details.
AWS Training in Bangalore
AWS Training in Bangalore
At that point I scanned for website architecture, site improvement, and pay per click Buy twitter followers
ReplyDeleteIt has been simply incredibly generous with you to provide openly what exactly many individuals would’ve marketed for an eBook to end up making some cash for their end, primarily given that you could have tried it in the event you wanted.
ReplyDeleteData Science Training in Bangalore
DataScience Training in Chennai
Informative post about hadoop, i am looking forward for realtime hadoop online training institute.
ReplyDeleteGreat article. May be create a short video/GIF about the working of the application. It will be very useful to see the working of the app.
ReplyDeleteAshwathi,
Facilitator,
Kamal Technologies - Best React JS, Angular JS, Node JS training institute in Chennai
This blog is very helpful for beginners and experts also, thanks for sharing it. Keep share content on MSBI Online Training Bangalore
ReplyDeletemany people come and go but i don't think that anyone can replace him https://twitter.com/darrenwinters01 follow this man for the best ideas about business..!!
ReplyDeletegreat
ReplyDeleteWhoa! I’m enjoying the template/theme of this website. It’s simple, yet effective. A lot of times it’s very hard to get that “perfect balance” between superb usability and visual appeal. I must say you’ve done a very good job with this.
ReplyDeleteAWS Training in Bangalore|
I simply wanted to thank you so much again. I am not sure the things that I might have gone through without the type of hints revealed by you regarding that situation.
ReplyDeleteamazon-web-services-training-institute-in-chennai
Best Hadoop Training Institute In chennai
I believe there are many more pleasurable opportunities ahead for individuals that looked at your site.
ReplyDeleteSelenium Training in chennai
Thanks a lot very much for the high quality and results-oriented help. I won’t think twice to endorse your blog post to anybody who wants and needs support about this area.
ReplyDeleteUI Path Training in Bangalore
My rather long internet look up has at the end of the day been compensated with pleasant insight to talk about with my family and friends.
ReplyDeletePython Training in Bangalore
Hello There,
ReplyDeleteA really interesting, clear and easily readable Network Automation Nerds article of interesting and different perspectives' will clap. So much is so well covered here.
I need some help on how to build this project and what c++ program to us, I have TC in stalled and when I build it comes up with and error or some think like that, all I want is to learn how to build projects and I really want to see how this project works.
I read multiple articles and watched many videos about how to use this tool - and was still confused! Your instructions were easy to understand and made the process simple.
Thanks and Regards,
Meera
This is a much needed information thank you for sharing and it's very helpful to know about this information. Thanks for sharing it MSBI Online Training
ReplyDeleteThis comment has been removed by the author.
ReplyDeleteThis is an excellent blog thanks for sharing valuable information with us please check it once at MSBI Online Training Hyderabad
ReplyDeleteGreat post and informative blog.it was awesome to read, thanks for sharing this great content to my vision.
ReplyDeleteembedded rtos training in chennai | embedded testing training in chennai .
Thanks for sharing information on,
ReplyDeleteBest Final Year Java Projects Chennai | Final Year Android Projects Chennai.
thanks this is good blog. Multiple Streams of income
ReplyDeleteThis comment has been removed by the author.
ReplyDeletethanks for conveying this information in a simpler manner..
ReplyDeletehttps://www.besanttechnologies.com/training-courses/python-training-institute-in-chennai
Very Good and Useful Information about python-and-aws Thanks For Sharing Nice Article anyone want to learn advance devops tools training or devops Online training
ReplyDeleteDevOps Online Training
Thank you for sharing such great information with us. I really appreciate everything that you’ve done here and am glad to know that you really care about the world that we live in
ReplyDeleteClick here:
angularjs training in velarchery
Click here:
angularjs training in sholinganallur
I am so proud of you and your efforts and work make me realize that anything can be done with patience and sincerity. Well I am here to say that your work has inspired me without a doubt.
ReplyDeleteClick here:
Microsoft azure training in bangalore
Click here:
Microsoft azure training in pune
Excellent blog, I wish to share your post with my folks circle. It’s really helped me a lot, so keep sharing post like this
ReplyDeleteBlueprism training in marathahalli
AWS Training in chennai
AWS Training in bangalore
Thanks you for sharing this unique useful information content with us. Really awesome work. keep on blogging
ReplyDeleteDevops training in velachery
Devops training in annanagar
Great post and informative blog.it was awesome to read, thanks for sharing this great content to my vision.
ReplyDeleteGood discussion.
PMP Training Course in Bangalore
PMP Training Course in Dammam
PMP Training Course in Dubai
PMP Training Course in Jeddah
PMP Training Course in Riyadh
A very nice guide. I will definitely follow these tips. Thank you for sharing such detailed article. I am learning a lot from you.
ReplyDeleterpa training in electronic-city | rpa training in btm | rpa training in marathahalli | rpa training in pune
That was a great message in my carrier, and It's wonderful commands like mind relaxes with understand words of knowledge by information's.
ReplyDeletejava training in annanagar | java training in chennai
java training in chennai | java training in electronic city
Thanks for your informative article, Your post helped me to understand the future and career prospects & Keep on updating your blog with such awesome article.
ReplyDeleteData Science training in rajaji nagar | Data Science with Python training in chenni
Data Science training in electronic city | Data Science training in USA
Data science training in pune | Data science training in kalyan nagar
very nice blog.it contains a lot of information for amazon web services(aws).Thanks a lot.aws online training
ReplyDeleteWell done! Pleasant post! This truly helps me to discover the solutions for my inquiry. Trusting, that you will keep posting articles having heaps of valuable data. You're the best!
ReplyDeleteangularjs Training in marathahalli
angularjs interview questions and answers
angularjs Training in bangalore
angularjs Training in bangalore
angularjs Training in chennai
Greetings. I know this is somewhat off-topic, but I was wondering if you knew where I could get a captcha plugin for my comment form? I’m using the same blog platform like yours, and I’m having difficulty finding one? Thanks a lot.
ReplyDeleteAWS Interview Questions And Answers
AWS Online Training | Online AWS Certification Course - Gangboard
AWS Training in Toronto| Amazon Web Services Training in Toronto, Canada
AWS Training in NewYork City | Amazon Web Services Training in Newyork City
AWS Training in London | Amazon Web Services Training in London, UK
AWS Training in Chennai | AWS Training Institute in Chennai Velachery, Tambaram, OMR
AWS Training in Bangalore |Best AWS Training Institute in BTM ,Marathahalli
Thanks for the information, Get the best AWS Training in Chennai from hope tutors.
ReplyDeleteThanks for the information. Nice blog. I understood the concept very well. This blog is very informative. And it’s very interesting topic.
ReplyDeletePython Training in Chennai
This comment has been removed by the author.
ReplyDeleteYour article inspired me to learn more.......
ReplyDeleteselenium training in chennai
java training in chennai
Really awesome work. keep on blogging, thanks for sharing!
ReplyDeleteDevOps Online Training
Thanks for this kind of worthy information. this was really very helpful to me. keep continuing.
ReplyDeleteIELTS Classes in Mumbai
IELTS Coaching in Mumbai
Best IELTS Coaching in Mumbai
IELTS Center in Mumbai
IELTS Training in Mumbai
IELTS Coaching Classes in Mumbai
IELTS Classes in near me
This is really too useful and have more ideas and keep sharing many techniques. Eagerly waiting for your new blog keep doing more.
ReplyDeletebest cloud computing institute in bangalore
Android Training Center in Bangalore
Android Institute in Bangalore
cloud computing training institutes in bangalore
best cloud computing training in bangalore
cloud computing certification in bangalore
But he’s trying none the less. I’ve been using Movable-type on several websites for about a year and am anxious about switching to another platform.
ReplyDeletefire and safety course in chennai
ReplyDeleteGood job in presenting the correct content with the clear explanation. The content looks real with valid information. Good Work
DevOps is currently a popular model currently organizations all over the world moving towards to it. Your post gave a clear idea about knowing the DevOps model and its importance.
Good to learn about DevOps at this time.
devops training in chennai | devops training in chennai with placement | devops training in chennai omr | devops training in velachery | devops training in chennai tambaram | devops institutes in chennai | devops certification in chennai | trending technologies list 2018
For this web site, you will see our account, remember to go through this info.
ReplyDeletemason soiza
Superb blog for the AWS Training in Chennai
ReplyDeleteThanks for sharing this pretty post, it was good and helpful. Share more like this.
ReplyDeleteReactJS Training in Chennai
AngularJS Training in Chennai
AngularJS course in Chennai
AWS Training in Chennai
DevOps Training in Chennai
RPA Training in Chennai
R Programming Training in Chennai
Wonderful Blog. Keep Posting.
ReplyDeleteAdvanced Excel Training in Chennai
Corporate Excel Training in Mumbai
Best Advanced Excel Training in bangalore
Power BI Training in Chennai
Thanks for sharing helpful blog...
ReplyDeletepython training in bangalore
python interview questions
python training in mumbai
python training in pune
Thanks for sharing this pretty post, it was good and helpful.
ReplyDeleteaws training in bangalore
artificial intelligence training in bangalore
machine learning training in bangalore
blockchain training in bangalore
iot training in bangalore
artificial intelligence certification
artificial intelligence certification
It is Very interesting post, with a lot of useful info, Thanks for Sharing a Very Educational Post. Keep it up
ReplyDeletePython Training Institute in Delhi
Python Training Institute in Noida
Python Training Institute in Gurgaon
That's a beautiful post. I can't wait to utilize the resources you've shared with us. Do share more such informative posts.
ReplyDeleteVMware Training in Chennai
VMware Course in Chennai
Mobile Testing Training in Chennai
Mobile Testing Course in Chennai
Unix Training in Chennai
Unix Shell Scripting Training in Chennai
VMware Training in Porur
VMware Training in Tambaram