Skip to content

Commit

Permalink
add files in categorymembers data pulling (#100)
Browse files Browse the repository at this point in the history
  • Loading branch information
barrust committed Dec 22, 2020
1 parent a6aa86f commit c2dc3d7
Show file tree
Hide file tree
Showing 3 changed files with 810 additions and 812 deletions.
4 changes: 2 additions & 2 deletions mediawiki/mediawiki.py
Expand Up @@ -672,7 +672,7 @@ def categorymembers(self, category, results=10, subcategories=True):
search_params = {
"list": "categorymembers",
"cmprop": "ids|title|type",
"cmtype": ("page|subcat" if subcategories else "page"),
"cmtype": ("page|subcat|file" if subcategories else "page|file"),
"cmlimit": (results if results is not None else max_pull),
"cmtitle": "{0}:{1}".format(self.category_prefix, category),
}
Expand All @@ -690,7 +690,7 @@ def categorymembers(self, category, results=10, subcategories=True):

current_pull = len(raw_res["query"]["categorymembers"])
for rec in raw_res["query"]["categorymembers"]:
if rec["type"] == "page":
if rec["type"] in ("page", "file"):
pages.append(rec["title"])
elif rec["type"] == "subcat":
tmp = rec["title"]
Expand Down
2 changes: 0 additions & 2 deletions tests/mediawiki_test.py
Expand Up @@ -1321,8 +1321,6 @@ def test_page_section_header(self):
wiki = MediaWikiOverloaded()
response = wiki.responses[wiki.api_url]
pg = wiki.page('New York City')
import json
print(json.dumps(pg.section(None)))
self.assertEqual(pg.section(None), response['new_york_city_none'])

def test_page_last_section_large(self):
Expand Down

0 comments on commit c2dc3d7

Please sign in to comment.