Wikipedia-API 0.6.9__tar.gz → 0.7.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {wikipedia_api-0.6.9 → wikipedia_api-0.7.2}/CHANGES.rst +11 -0
- {wikipedia_api-0.6.9 → wikipedia_api-0.7.2}/PKG-INFO +14 -9
- {wikipedia_api-0.6.9 → wikipedia_api-0.7.2}/README.rst +1 -7
- {wikipedia_api-0.6.9 → wikipedia_api-0.7.2}/Wikipedia_API.egg-info/PKG-INFO +14 -9
- {wikipedia_api-0.6.9 → wikipedia_api-0.7.2}/setup.py +2 -2
- {wikipedia_api-0.6.9 → wikipedia_api-0.7.2}/wikipediaapi/__init__.py +14 -13
- {wikipedia_api-0.6.9 → wikipedia_api-0.7.2}/API.rst +0 -0
- {wikipedia_api-0.6.9 → wikipedia_api-0.7.2}/DEVELOPMENT.rst +0 -0
- {wikipedia_api-0.6.9 → wikipedia_api-0.7.2}/LICENSE +0 -0
- {wikipedia_api-0.6.9 → wikipedia_api-0.7.2}/MANIFEST.in +0 -0
- {wikipedia_api-0.6.9 → wikipedia_api-0.7.2}/Wikipedia_API.egg-info/SOURCES.txt +0 -0
- {wikipedia_api-0.6.9 → wikipedia_api-0.7.2}/Wikipedia_API.egg-info/dependency_links.txt +0 -0
- {wikipedia_api-0.6.9 → wikipedia_api-0.7.2}/Wikipedia_API.egg-info/not-zip-safe +0 -0
- {wikipedia_api-0.6.9 → wikipedia_api-0.7.2}/Wikipedia_API.egg-info/requires.txt +0 -0
- {wikipedia_api-0.6.9 → wikipedia_api-0.7.2}/Wikipedia_API.egg-info/top_level.txt +0 -0
- {wikipedia_api-0.6.9 → wikipedia_api-0.7.2}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: Wikipedia-API
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.7.2
|
|
4
4
|
Summary: Python Wrapper for Wikipedia
|
|
5
5
|
Home-page: https://github.com/martin-majlis/Wikipedia-API
|
|
6
6
|
Download-URL: https://github.com/martin-majlis/Wikipedia-API/archive/master.tar.gz
|
|
@@ -14,11 +14,11 @@ Classifier: Environment :: Web Environment
|
|
|
14
14
|
Classifier: Intended Audience :: Developers
|
|
15
15
|
Classifier: Programming Language :: Python
|
|
16
16
|
Classifier: Programming Language :: Python :: 3
|
|
17
|
-
Classifier: Programming Language :: Python :: 3.8
|
|
18
17
|
Classifier: Programming Language :: Python :: 3.9
|
|
19
18
|
Classifier: Programming Language :: Python :: 3.10
|
|
20
19
|
Classifier: Programming Language :: Python :: 3.11
|
|
21
20
|
Classifier: Programming Language :: Python :: 3.12
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
22
22
|
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
23
23
|
Classifier: Programming Language :: Python :: Implementation :: PyPy
|
|
24
24
|
Classifier: License :: OSI Approved :: MIT License
|
|
@@ -36,7 +36,7 @@ Wikipedia API
|
|
|
36
36
|
|
|
37
37
|
.. _Wikipedias': https://www.mediawiki.org/wiki/API:Main_page
|
|
38
38
|
|
|
39
|
-
|
|
|
39
|
+
|github-stars-flat| |cc-coverage| |docs| |version| |pyversions|
|
|
40
40
|
|
|
41
41
|
Installation
|
|
42
42
|
------------
|
|
@@ -345,12 +345,10 @@ External Links
|
|
|
345
345
|
|
|
346
346
|
* `GitHub`_
|
|
347
347
|
* `PyPi`_
|
|
348
|
-
* `Travis`_
|
|
349
348
|
* `ReadTheDocs`_
|
|
350
349
|
|
|
351
350
|
.. _GitHub: https://github.com/martin-majlis/Wikipedia-API/
|
|
352
351
|
.. _PyPi: https://pypi.python.org/pypi/Wikipedia-API/
|
|
353
|
-
.. _Travis: https://travis-ci.org/martin-majlis/Wikipedia-API/
|
|
354
352
|
.. _ReadTheDocs: http://wikipedia-api.readthedocs.io/
|
|
355
353
|
|
|
356
354
|
Other Badges
|
|
@@ -371,10 +369,6 @@ Other Pages
|
|
|
371
369
|
|
|
372
370
|
|
|
373
371
|
|
|
374
|
-
.. |build-status| image:: https://travis-ci.org/martin-majlis/Wikipedia-API.svg?branch=master
|
|
375
|
-
:alt: build status
|
|
376
|
-
:target: https://travis-ci.org/martin-majlis/Wikipedia-API
|
|
377
|
-
|
|
378
372
|
.. |docs| image:: https://readthedocs.org/projects/wikipedia-api/badge/?version=latest
|
|
379
373
|
:target: http://wikipedia-api.readthedocs.io/en/latest/?badge=latest
|
|
380
374
|
:alt: Documentation Status
|
|
@@ -502,6 +496,17 @@ Other Pages
|
|
|
502
496
|
Changelog
|
|
503
497
|
=========
|
|
504
498
|
|
|
499
|
+
0.7.2
|
|
500
|
+
-----
|
|
501
|
+
|
|
502
|
+
* Add support for Python 3.13
|
|
503
|
+
* Regenerate stable documentation
|
|
504
|
+
|
|
505
|
+
0.7.1
|
|
506
|
+
-----
|
|
507
|
+
|
|
508
|
+
* Drop support for Python 3.8
|
|
509
|
+
|
|
505
510
|
0.6.9
|
|
506
511
|
-----
|
|
507
512
|
|
|
@@ -5,7 +5,7 @@ Wikipedia API
|
|
|
5
5
|
|
|
6
6
|
.. _Wikipedias': https://www.mediawiki.org/wiki/API:Main_page
|
|
7
7
|
|
|
8
|
-
|
|
|
8
|
+
|github-stars-flat| |cc-coverage| |docs| |version| |pyversions|
|
|
9
9
|
|
|
10
10
|
Installation
|
|
11
11
|
------------
|
|
@@ -314,12 +314,10 @@ External Links
|
|
|
314
314
|
|
|
315
315
|
* `GitHub`_
|
|
316
316
|
* `PyPi`_
|
|
317
|
-
* `Travis`_
|
|
318
317
|
* `ReadTheDocs`_
|
|
319
318
|
|
|
320
319
|
.. _GitHub: https://github.com/martin-majlis/Wikipedia-API/
|
|
321
320
|
.. _PyPi: https://pypi.python.org/pypi/Wikipedia-API/
|
|
322
|
-
.. _Travis: https://travis-ci.org/martin-majlis/Wikipedia-API/
|
|
323
321
|
.. _ReadTheDocs: http://wikipedia-api.readthedocs.io/
|
|
324
322
|
|
|
325
323
|
Other Badges
|
|
@@ -349,10 +347,6 @@ Other Pages
|
|
|
349
347
|
.. PYPI-END
|
|
350
348
|
|
|
351
349
|
|
|
352
|
-
.. |build-status| image:: https://travis-ci.org/martin-majlis/Wikipedia-API.svg?branch=master
|
|
353
|
-
:alt: build status
|
|
354
|
-
:target: https://travis-ci.org/martin-majlis/Wikipedia-API
|
|
355
|
-
|
|
356
350
|
.. |docs| image:: https://readthedocs.org/projects/wikipedia-api/badge/?version=latest
|
|
357
351
|
:target: http://wikipedia-api.readthedocs.io/en/latest/?badge=latest
|
|
358
352
|
:alt: Documentation Status
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: Wikipedia-API
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.7.2
|
|
4
4
|
Summary: Python Wrapper for Wikipedia
|
|
5
5
|
Home-page: https://github.com/martin-majlis/Wikipedia-API
|
|
6
6
|
Download-URL: https://github.com/martin-majlis/Wikipedia-API/archive/master.tar.gz
|
|
@@ -14,11 +14,11 @@ Classifier: Environment :: Web Environment
|
|
|
14
14
|
Classifier: Intended Audience :: Developers
|
|
15
15
|
Classifier: Programming Language :: Python
|
|
16
16
|
Classifier: Programming Language :: Python :: 3
|
|
17
|
-
Classifier: Programming Language :: Python :: 3.8
|
|
18
17
|
Classifier: Programming Language :: Python :: 3.9
|
|
19
18
|
Classifier: Programming Language :: Python :: 3.10
|
|
20
19
|
Classifier: Programming Language :: Python :: 3.11
|
|
21
20
|
Classifier: Programming Language :: Python :: 3.12
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
22
22
|
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
23
23
|
Classifier: Programming Language :: Python :: Implementation :: PyPy
|
|
24
24
|
Classifier: License :: OSI Approved :: MIT License
|
|
@@ -36,7 +36,7 @@ Wikipedia API
|
|
|
36
36
|
|
|
37
37
|
.. _Wikipedias': https://www.mediawiki.org/wiki/API:Main_page
|
|
38
38
|
|
|
39
|
-
|
|
|
39
|
+
|github-stars-flat| |cc-coverage| |docs| |version| |pyversions|
|
|
40
40
|
|
|
41
41
|
Installation
|
|
42
42
|
------------
|
|
@@ -345,12 +345,10 @@ External Links
|
|
|
345
345
|
|
|
346
346
|
* `GitHub`_
|
|
347
347
|
* `PyPi`_
|
|
348
|
-
* `Travis`_
|
|
349
348
|
* `ReadTheDocs`_
|
|
350
349
|
|
|
351
350
|
.. _GitHub: https://github.com/martin-majlis/Wikipedia-API/
|
|
352
351
|
.. _PyPi: https://pypi.python.org/pypi/Wikipedia-API/
|
|
353
|
-
.. _Travis: https://travis-ci.org/martin-majlis/Wikipedia-API/
|
|
354
352
|
.. _ReadTheDocs: http://wikipedia-api.readthedocs.io/
|
|
355
353
|
|
|
356
354
|
Other Badges
|
|
@@ -371,10 +369,6 @@ Other Pages
|
|
|
371
369
|
|
|
372
370
|
|
|
373
371
|
|
|
374
|
-
.. |build-status| image:: https://travis-ci.org/martin-majlis/Wikipedia-API.svg?branch=master
|
|
375
|
-
:alt: build status
|
|
376
|
-
:target: https://travis-ci.org/martin-majlis/Wikipedia-API
|
|
377
|
-
|
|
378
372
|
.. |docs| image:: https://readthedocs.org/projects/wikipedia-api/badge/?version=latest
|
|
379
373
|
:target: http://wikipedia-api.readthedocs.io/en/latest/?badge=latest
|
|
380
374
|
:alt: Documentation Status
|
|
@@ -502,6 +496,17 @@ Other Pages
|
|
|
502
496
|
Changelog
|
|
503
497
|
=========
|
|
504
498
|
|
|
499
|
+
0.7.2
|
|
500
|
+
-----
|
|
501
|
+
|
|
502
|
+
* Add support for Python 3.13
|
|
503
|
+
* Regenerate stable documentation
|
|
504
|
+
|
|
505
|
+
0.7.1
|
|
506
|
+
-----
|
|
507
|
+
|
|
508
|
+
* Drop support for Python 3.8
|
|
509
|
+
|
|
505
510
|
0.6.9
|
|
506
511
|
-----
|
|
507
512
|
|
|
@@ -27,7 +27,7 @@ tests_require = [] # type: List[str]
|
|
|
27
27
|
|
|
28
28
|
setup(
|
|
29
29
|
name="Wikipedia-API",
|
|
30
|
-
version="0.
|
|
30
|
+
version="0.7.2",
|
|
31
31
|
description="Python Wrapper for Wikipedia",
|
|
32
32
|
long_description=README + "\n\n" + CHANGES,
|
|
33
33
|
classifiers=[
|
|
@@ -36,11 +36,11 @@ setup(
|
|
|
36
36
|
"Intended Audience :: Developers",
|
|
37
37
|
"Programming Language :: Python",
|
|
38
38
|
"Programming Language :: Python :: 3",
|
|
39
|
-
"Programming Language :: Python :: 3.8",
|
|
40
39
|
"Programming Language :: Python :: 3.9",
|
|
41
40
|
"Programming Language :: Python :: 3.10",
|
|
42
41
|
"Programming Language :: Python :: 3.11",
|
|
43
42
|
"Programming Language :: Python :: 3.12",
|
|
43
|
+
"Programming Language :: Python :: 3.13",
|
|
44
44
|
"Programming Language :: Python :: Implementation :: CPython",
|
|
45
45
|
"Programming Language :: Python :: Implementation :: PyPy",
|
|
46
46
|
"License :: OSI Approved :: MIT License",
|
|
@@ -6,12 +6,13 @@ from Wikipedia. Documentation provides code snippets for the most common use
|
|
|
6
6
|
cases.
|
|
7
7
|
"""
|
|
8
8
|
|
|
9
|
-
__version__ = (0,
|
|
9
|
+
__version__ = (0, 7, 2)
|
|
10
|
+
|
|
10
11
|
from collections import defaultdict
|
|
11
12
|
from enum import IntEnum
|
|
12
13
|
import logging
|
|
13
14
|
import re
|
|
14
|
-
from typing import Any,
|
|
15
|
+
from typing import Any, Optional, Union
|
|
15
16
|
from urllib import parse
|
|
16
17
|
|
|
17
18
|
import requests
|
|
@@ -26,7 +27,7 @@ log = logging.getLogger(__name__)
|
|
|
26
27
|
|
|
27
28
|
|
|
28
29
|
# https://www.mediawiki.org/wiki/API:Main_page
|
|
29
|
-
PagesDict =
|
|
30
|
+
PagesDict = dict[str, "WikipediaPage"]
|
|
30
31
|
|
|
31
32
|
|
|
32
33
|
class ExtractFormat(IntEnum):
|
|
@@ -133,7 +134,7 @@ class Wikipedia:
|
|
|
133
134
|
user_agent: str,
|
|
134
135
|
language: str = "en",
|
|
135
136
|
extract_format: ExtractFormat = ExtractFormat.WIKI,
|
|
136
|
-
headers: Optional[
|
|
137
|
+
headers: Optional[dict[str, Any]] = None,
|
|
137
138
|
**kwargs,
|
|
138
139
|
) -> None:
|
|
139
140
|
"""
|
|
@@ -282,7 +283,7 @@ class Wikipedia:
|
|
|
282
283
|
"action": "query",
|
|
283
284
|
"prop": "extracts",
|
|
284
285
|
"titles": page.title,
|
|
285
|
-
} # type:
|
|
286
|
+
} # type: dict[str, Any]
|
|
286
287
|
|
|
287
288
|
if self.extract_format == ExtractFormat.HTML:
|
|
288
289
|
# we do nothing, when format is HTML
|
|
@@ -516,7 +517,7 @@ class Wikipedia:
|
|
|
516
517
|
|
|
517
518
|
return self._build_categorymembers(v, page)
|
|
518
519
|
|
|
519
|
-
def _query(self, page: "WikipediaPage", params:
|
|
520
|
+
def _query(self, page: "WikipediaPage", params: dict[str, Any]):
|
|
520
521
|
"""Queries Wikimedia API to fetch content."""
|
|
521
522
|
base_url = "https://" + page.language + ".wikipedia.org/w/api.php"
|
|
522
523
|
log.info(
|
|
@@ -701,7 +702,7 @@ class WikipediaPageSection:
|
|
|
701
702
|
self._title = title
|
|
702
703
|
self._level = level
|
|
703
704
|
self._text = text
|
|
704
|
-
self._section = [] # type:
|
|
705
|
+
self._section = [] # type: list['WikipediaPageSection']
|
|
705
706
|
|
|
706
707
|
@property
|
|
707
708
|
def title(self) -> str:
|
|
@@ -731,7 +732,7 @@ class WikipediaPageSection:
|
|
|
731
732
|
return self._text
|
|
732
733
|
|
|
733
734
|
@property
|
|
734
|
-
def sections(self) ->
|
|
735
|
+
def sections(self) -> list["WikipediaPageSection"]:
|
|
735
736
|
"""
|
|
736
737
|
Returns subsections of the current section.
|
|
737
738
|
|
|
@@ -835,8 +836,8 @@ class WikipediaPage:
|
|
|
835
836
|
) -> None:
|
|
836
837
|
self.wiki = wiki
|
|
837
838
|
self._summary = "" # type: str
|
|
838
|
-
self._section = [] # type:
|
|
839
|
-
self._section_mapping = {} # type:
|
|
839
|
+
self._section = [] # type: list[WikipediaPageSection]
|
|
840
|
+
self._section_mapping = {} # type: dict[str, list[WikipediaPageSection]]
|
|
840
841
|
self._langlinks = {} # type: PagesDict
|
|
841
842
|
self._links = {} # type: PagesDict
|
|
842
843
|
self._backlinks = {} # type: PagesDict
|
|
@@ -857,7 +858,7 @@ class WikipediaPage:
|
|
|
857
858
|
"title": title,
|
|
858
859
|
"ns": namespace2int(ns),
|
|
859
860
|
"language": language,
|
|
860
|
-
} # type:
|
|
861
|
+
} # type: dict[str, Any]
|
|
861
862
|
|
|
862
863
|
if url is not None:
|
|
863
864
|
self._attributes["fullurl"] = url
|
|
@@ -921,7 +922,7 @@ class WikipediaPage:
|
|
|
921
922
|
return self._summary
|
|
922
923
|
|
|
923
924
|
@property
|
|
924
|
-
def sections(self) ->
|
|
925
|
+
def sections(self) -> list[WikipediaPageSection]:
|
|
925
926
|
"""
|
|
926
927
|
Returns all sections of the curent page.
|
|
927
928
|
|
|
@@ -951,7 +952,7 @@ class WikipediaPage:
|
|
|
951
952
|
def sections_by_title(
|
|
952
953
|
self,
|
|
953
954
|
title: str,
|
|
954
|
-
) ->
|
|
955
|
+
) -> list[WikipediaPageSection]:
|
|
955
956
|
"""
|
|
956
957
|
Returns all section of the current page with given `title`.
|
|
957
958
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|