Month: February 2017

Learning Python – make a URL request

rosetwoandbuds002  Been learning Python lately.  Have done a couple of tutorials and one or two simple programs.  This post will be about a simple example of how to access some real estate information that is available from a company called Trulia.

First, some links to sites that helped me figure this out:

  • Download Python, install, and some reference documentation:
  • Stackoverflow thread about making a URL request in Python:
  • How to make a Trulia RSS feed with your real estate search criteria:
  • Some free python IDEs:
  • I decided to go with Visual Studio for an IDE. I picked the custom installation so I could specify Python as a supported language.

The code:

#Just a little POC to retrieve some real estate information from the web
#Python 3
import urllib.request #for opening connections to URLs

def main():

  truliaURL = ',CA/'

  request = urllib.request.Request(truliaURL)
  response = urllib.request.urlopen(request)
  responseData ='utf-8')

if __name__ == "__main__":