diff options
-rw-r--r-- | wikimini/__init__.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/wikimini/__init__.py b/wikimini/__init__.py index 6c2f2a6..f927a94 100644 --- a/wikimini/__init__.py +++ b/wikimini/__init__.py @@ -5,7 +5,7 @@ import requests from tabulate import tabulate -from typing import List, Union, Tuple, Sequence +from typing import List, Union, Tuple, Sequence, Iterable, cast from .document import ( Plain, BlockLink, InlineLink, Verbatim, Document, Node, Block, ItemList, @@ -81,7 +81,7 @@ class Wikimini: "prop": "revisions", "rvprop": "content", "rvslots": "main", - "rvlimit": 1, + "rvlimit": "1", "titles": title, "format": "json", "formatversion": "2", @@ -142,12 +142,13 @@ class Wikimini: pass # Special case: We're starting a list! elif len(current) == 1 and isinstance(current[0], ItemList): - document.extend(current) + document.append(current[0]) elif isinstance(current[0], Block): - document.extend(current) + document.extend(cast(Iterable[Block], current)) document.append(Paragraph([])) elif isinstance(current[0], Node): for c in current: + assert isinstance(c, Node) insert_into(document, c) return document elif isinstance(obj, mwp.nodes.heading.Heading): |