From 52ec05608a1fef5c34ca125071125c926decc073 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Dan=20Michael=20O=2E=20Hegg=C3=B8?= <danmichaelo@gmail.com>
Date: Sat, 16 Nov 2013 18:45:52 +0100
Subject: [PATCH] PEP8, code cleanup, add docstring

---
 mwclient/client.py | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/mwclient/client.py b/mwclient/client.py
index f8ae912..c628662 100644
--- a/mwclient/client.py
+++ b/mwclient/client.py
@@ -58,8 +58,7 @@ class Site(object):
         self.ext = ext
         self.credentials = None
         self.compress = compress
-        if httpauth:
-            self.httpauth = httpauth
+        self.httpauth = httpauth
         self.retry_timeout = retry_timeout
         self.max_retries = max_retries
         self.wait_callback = wait_callback
@@ -222,9 +221,9 @@ class Site(object):
             headers['Content-Type'] = 'application/x-www-form-urlencoded'
         if self.compress and gzip:
             headers['Accept-Encoding'] = 'gzip'
-        if self.httpauth:
+        if self.httpauth is not None:
             credentials = base64.encodestring('%s:%s' % self.httpauth).replace('\n', '')
-            headers['Authorization']  = "Basic %s" % credentials
+            headers['Authorization'] = 'Basic %s' % credentials
         token = self.wait_token((script, data))
         while True:
             try:
@@ -624,8 +623,10 @@ class Site(object):
         else:
             return result['expandtemplates']['*']
 
-    def ask(self, query, title = None):
+    def ask(self, query, title=None):
+        """Ask a query against Semantic MediaWiki."""
         kwargs = {}
-        if title is None: kwargs['title'] = title
-        result = self.raw_api('ask', query = query, **kwargs)
+        if title is None:
+            kwargs['title'] = title
+        result = self.raw_api('ask', query=query, **kwargs)
         return result['query']['results']
-- 
GitLab