String in Python 2 and 3

Python 2’s unicode() type was renamed str() in Python 3, str() was renamed bytes(), and basestring() disappeared

In Python 3 all strings are Unicode while in Python 2 strings are bytes by default


from oauth2client.client import OAuth2WebServerFlow


# server side
def get_flow(redirect_url=None):
    return OAuth2WebServerFlow(client_id=GOOGLE_CLIENT_ID,
                               scope='profile email',

# Server create the oauth link with return url
flow = get_flow('http://localhost:8000/auth/next/')
url = flow.step1_get_authorize_url()
# Client side
# Client redirect user to this url:
# Internal Google redirection:
#       &continue=
# Google interactive login page
# Google finally redirect user to the return url
#  http://localhost:8000/auth/next/?code=******
# Server get credentials from server
code = '******'
credentials = flow.step2_exchange(code)

Simple HTTP Server with Python

$ python -m SimpleHTTPServer 8002
# Python 3
$ python -m http.server 8002

What exactly does the T and Z mean in timestamp?

The T doesn’t really stand for anything. It is just the separator that the ISO 8601 combined date-time format requires. You can read it as an abbreviation for Time.

The Z stands for the Zero timezone, as it is offset by 0 from the Coordinated Universal Time (UTC).

Both characters are just static letters in the format, which is why they are not documented by the datetime.strftime() method. You could have used Q or M or Monty Python and the method would have returned them unchanged as well; the method only looks for patterns starting with % to replace those with information from the datetime object.