|
|
@@ -11,14 +11,23 @@ class Page(object): |
|
|
|
""" |
|
|
|
self.site = site |
|
|
|
self.title = title |
|
|
|
self._content = None |
|
|
|
|
|
|
|
def get(self): |
|
|
|
def exists(self): |
|
|
|
""" |
|
|
|
Docstring needed |
|
|
|
""" |
|
|
|
params = {'action': 'query', 'prop': 'revisions', 'rvprop':'content', 'rvlimit':'1'} |
|
|
|
params["titles"] = self.title |
|
|
|
result = self.site.api_query(params) |
|
|
|
pageid = result['query']['pages'].keys()[0] |
|
|
|
content = result['query']['pages'][pageid]['revisions'][0]['*'] |
|
|
|
return content |
|
|
|
pass |
|
|
|
|
|
|
|
def get(self, force_reload=False): |
|
|
|
""" |
|
|
|
Docstring needed |
|
|
|
""" |
|
|
|
if content is None or force_reload: |
|
|
|
params = {"action": "query", "prop": "revisions", |
|
|
|
"rvprop": "content", "rvlimit": 1, "titles": self.title} |
|
|
|
result = self.site.api_query(params) |
|
|
|
content = result["query"]["pages"].values()[0]["revisions"][0]["*"] |
|
|
|
self._content = content |
|
|
|
return content |
|
|
|
return self._content |