Changes: global constants to class-variables, urlencode urlstring, fix typos/coding style; Add: edit token management, debugging, documentation

Ok here is the promised pull-request.
I planned to make a few small ones. But my github-fu is not yet strong enough so it became this big one.
Hopefully that's not such a big problem. You should be able to cherry-pick the changes you want, shouldn't you?

For me this code works really well. I used it to mass-upload files and create and edit pages...