import atom.http_core
redirected_page = 'http://path/that/you/set?code=RANDOM-CODE'
uri = atom.http_core.ParseUri(redirected_page)
token.get_access_token(uri.query)
Authenticating to Calendar with Python gdata and oAuth 2