Learning Python Part: 1

I decided it was time to learn a programming language that I could use for virtual environment management and orchestration. There are several that would have worked, PowerShell, Bash, Ruby, but I chose python. I prefer Object based programming and the vast library that the python community has built. There are already builds such as pysphere and pyVim that make the time to functional much shorter.

I am still studying and learning in no way do I understand everything about python. I started using CodeAcademy.com  to get some of the basics. One of my colleagues turned me onto Learn Python the Hard Way so I built some different projects. Easy stuff like Text based games or query calls. The same colleague then turned me onto writing a widget that called a web based API and returned a search function. The API to call was twitter, I initially did a google search and looked at some code snippets.

What I found was this easy enough but the problem was I didn’t like the way it returned only the search result that was hard coded into the widget. What if I wanted to embed this at some point and would need the user to be able to actually enter data. I kept thinking of vbs and tried to pass a variable for term, but the twitter api has limited functionality.

So here is what I tried first


var = raw_input(“Search Term”),

term= (var),






Like I said though var doesn’t work in the twitter api, but the raw_input was the right way to go. (Tip of the hat to Matt Cowger on this one.) Matt helped me out and directed showed me that I needed to go a slightly different way:

search = api.GetSearch(
    term=raw_input(“Search Term”),
Now in the console I get the Search Term prompt for text and can search any term I want. Still not a super useful tool but a good start.
Working on building GUIs for these sort of widgets now so if you are into geeking out on learning code, stay tuned.