I’m trying to programmatically construct a URL to query a google webservice and struggling to get the right thing. An example of the type of URL i’m trying to generate is as follows:
In the above example, I would like to swap out the title name (Avatar) and the release date (2009). It's also got to be able to handle characters in the title more than just spaces, e.g. "The A-Team". "Harry Potter and the Deathly Hallows: Part 1", etc.
Anyone know how best to do this? I'm pretty sure I should be using urllib2 and the encode function. Just not too sure of the exact specifics!
Would this not mean that the "search_string" which is inserted into my url would include a space character, instead of being replaced with a "%20"? That's why i'm keen to use url encoding so that it can handle all the rules regarding translating characters, like space and others, into the appropriate web standard.