Remove unused variable.
Wrap execution with with 'if __name__' guard.

This is a step to help with the modularization of the program.
Move code for token extraction to a function.

While we are at it, we also remove the request variable, as it was only set,
but not used further.
Merge pull request #9 from rbrito/refactoring/take-00

Refactoring