I am trying to write a scipt which will take a movie name, search it in google with 'I am Feeling lucky' and return the redirected page.

import urllib.request
import urllib.response
import urllib.parse


url= 'http://www.google.co.in/search'
values = {'hl' : 'en',
          'q' : 'Departed imdb',
          'btnI' : 'I\'m Feeling Lucky' }

data = urllib.parse.urlencode(values)
req = urllib.request.Request(url, data)
response = urllib.request.urlopen(req)
urlresponse = response.geturl()

But it gives me this error :

Traceback (most recent call last):
  File "D:\Scripts\imdb.py", line 19, in <module>
    response = urllib.request.urlopen(req)
  File "D:\ProgramFiles\Python30\lib\urllib\request.py", line 122, in urlopen
    return _opener.open(url, data, timeout)
  File "D:\ProgramFiles\Python30\lib\urllib\request.py", line 364, in open
    response = meth(req, response)
  File "D:\ProgramFiles\Python30\lib\urllib\request.py", line 476, in http_response
    'http', request, response, code, msg, hdrs)
  File "D:\ProgramFiles\Python30\lib\urllib\request.py", line 402, in error
    return self._call_chain(*args)
  File "D:\ProgramFiles\Python30\lib\urllib\request.py", line 336, in _call_chain
    result = func(*args)
  File "D:\ProgramFiles\Python30\lib\urllib\request.py", line 484, in http_error_default
    raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 405: Method Not Allowed

Google appears to be blocking the method you're using. Have you tried any debugging?