mediawiki-utilities / python-mwapi

Simple Python Wrapper around MediaWiki API
http://pythonhosted.org/mwapi
MIT License
31 stars 11 forks source link

updated function get_tokens #4

Closed ghost closed 11 years ago

ghost commented 11 years ago

Save tokens in self.tokens and throw warning/s if token for any requested action is not supported for user.

yuvipanda commented 11 years ago

Thanks for the contributions! However, multiple problems exist.

  1. Saving tokens in self is a bad idea - because you can never know if they are valid or not at that point of time. Hence just returning them - caching and validation will have to be done by the application
  2. python-mwapi is a library, and hence should never use 'print'. A better way would be to perhaps throw an exception, or set them to None.