├── tests ├── __init__.py ├── lang_test.py ├── search_test.py ├── geosearch_test.py ├── page_test.py └── request_mock_data.py ├── MANIFEST.in ├── requirements.txt ├── wikipedia ├── __init__.py ├── util.py ├── exceptions.py └── wikipedia.py ├── runtests ├── docs ├── source │ ├── _themes │ │ └── flask_small │ │ │ ├── theme.conf │ │ │ ├── layout.html │ │ │ └── static │ │ │ └── flasky.css_t │ ├── index.rst │ ├── code.rst │ ├── quickstart.rst │ └── conf.py └── Makefile ├── .travis.yml ├── .gitignore ├── LICENSE ├── setup.py ├── CHANGELOG.md └── README.rst /tests/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /MANIFEST.in: -------------------------------------------------------------------------------- 1 | include README.rst LICENSE requirements.txt -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | beautifulsoup4 2 | requests>=2.0.0,<3.0.0 3 | -------------------------------------------------------------------------------- /wikipedia/__init__.py: -------------------------------------------------------------------------------- 1 | from .wikipedia import * 2 | from .exceptions import * 3 | 4 | __version__ = (1, 4, 0) 5 | -------------------------------------------------------------------------------- /runtests: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | python -m unittest discover tests/ '*test.py' && 4 | python3 -m unittest discover tests/ '*test.py' 5 | -------------------------------------------------------------------------------- /docs/source/_themes/flask_small/theme.conf: -------------------------------------------------------------------------------- 1 | [theme] 2 | inherit = basic 3 | stylesheet = flasky.css 4 | nosidebar = true 5 | pygments_style = flask_theme_support.FlaskyStyle 6 | 7 | [options] 8 | index_logo = '' 9 | index_logo_height = 120px 10 | github_fork = goldsmith/Wikipedia 11 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: python 2 | python: 3 | - 2.7 4 | - 3.3 5 | - 3.4 6 | env: 7 | - REQUESTS=2.0.0 8 | - REQUESTS=2.1.0 9 | - REQUESTS=2.2.0 10 | - REQUESTS=2.3.0 11 | install: 12 | - pip install -q requests==$REQUESTS 13 | - pip install -r requirements.txt 14 | - pip install -e . 15 | script: python -m unittest discover tests/ '*test.py' 16 | -------------------------------------------------------------------------------- /tests/lang_test.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | import unittest 3 | 4 | from wikipedia import wikipedia 5 | 6 | 7 | class TestLang(unittest.TestCase): 8 | """Test the ability for wikipedia to change the language of the API being accessed.""" 9 | 10 | def test_lang(self): 11 | wikipedia.set_lang("fr") 12 | self.assertEqual(wikipedia.API_URL, 'http://fr.wikipedia.org/w/api.php') 13 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Generated by http://gitignore.io 2 | 3 | ### Python ### 4 | *.py[cod] 5 | 6 | # C extensions 7 | *.so 8 | 9 | # Packages 10 | *.egg 11 | *.egg-info 12 | dist 13 | build 14 | eggs 15 | parts 16 | bin 17 | var 18 | sdist 19 | develop-eggs 20 | .installed.cfg 21 | lib 22 | lib64 23 | __pycache__ 24 | 25 | # Installer logs 26 | pip-log.txt 27 | 28 | # Unit test / coverage reports 29 | .coverage 30 | cover 31 | .tox 32 | nosetests.xml 33 | 34 | # Translations 35 | *.mo 36 | 37 | # Mr Developer 38 | .mr.developer.cfg 39 | .project 40 | .pydevproject -------------------------------------------------------------------------------- /docs/source/_themes/flask_small/layout.html: -------------------------------------------------------------------------------- 1 | {% extends "basic/layout.html" %} 2 | {% block header %} 3 | {{ super() }} 4 | {% if pagename == 'index' %} 5 |
6 | {% endif %} 7 | {% endblock %} 8 | {% block footer %} 9 | {% if pagename == 'index' %} 10 |
11 | {% endif %} 12 | {% endblock %} 13 | {# do not display relbars #} 14 | {% block relbar1 %}{% endblock %} 15 | {% block relbar2 %} 16 | {% if theme_github_fork %} 17 | Fork me on GitHub 19 | {% endif %} 20 | {% endblock %} 21 | {% block sidebar1 %}{% endblock %} 22 | {% block sidebar2 %}{% endblock %} 23 | -------------------------------------------------------------------------------- /docs/source/index.rst: -------------------------------------------------------------------------------- 1 | .. _index: 2 | 3 | Wikipedia 4 | ========= 5 | 6 | Wikipedia 7 | ********* 8 | 9 | Wikipedia is a Python library that makes it easy to access and parse data from Wikipedia. 10 | 11 | Search Wikipedia, get article summaries, get data like links and images from a page, and more. Wikipedia wraps the `MediaWiki API `_ so you can focus on using Wikipedia data, not getting it. 12 | 13 | :: 14 | 15 | >>> import wikipedia 16 | 17 | >>> print wikipedia.summary("Wikipedia") 18 | # Wikipedia (/ˌwɪkɨˈpiːdiə/ or /ˌwɪkiˈpiːdiə/ WIK-i-PEE-dee-ə) is a collaboratively edited, multilingual, free Internet encyclopedia supported by the non-profit Wikimedia Foundation... 19 | 20 | Go to the :ref:`quickstart` to start using ``wikipedia`` now, or see the :ref:`api`. 21 | 22 | Indices and tables 23 | ================== 24 | 25 | * :ref:`genindex` 26 | * :ref:`modindex` 27 | * :ref:`search` -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2013 Jonathan Goldsmith 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. -------------------------------------------------------------------------------- /wikipedia/util.py: -------------------------------------------------------------------------------- 1 | from __future__ import print_function, unicode_literals 2 | 3 | import sys 4 | import functools 5 | 6 | def debug(fn): 7 | def wrapper(*args, **kwargs): 8 | print(fn.__name__, 'called!') 9 | print(sorted(args), tuple(sorted(kwargs.items()))) 10 | res = fn(*args, **kwargs) 11 | print(res) 12 | return res 13 | return wrapper 14 | 15 | 16 | class cache(object): 17 | 18 | def __init__(self, fn): 19 | self.fn = fn 20 | self._cache = {} 21 | functools.update_wrapper(self, fn) 22 | 23 | def __call__(self, *args, **kwargs): 24 | key = str(args) + str(kwargs) 25 | if key in self._cache: 26 | ret = self._cache[key] 27 | else: 28 | ret = self._cache[key] = self.fn(*args, **kwargs) 29 | 30 | return ret 31 | 32 | def clear_cache(self): 33 | self._cache = {} 34 | 35 | 36 | # from http://stackoverflow.com/questions/3627793/best-output-type-and-encoding-practices-for-repr-functions 37 | def stdout_encode(u, default='UTF8'): 38 | encoding = sys.stdout.encoding or default 39 | if sys.version_info > (3, 0): 40 | return u.encode(encoding).decode(encoding) 41 | return u.encode(encoding) 42 | -------------------------------------------------------------------------------- /docs/source/code.rst: -------------------------------------------------------------------------------- 1 | .. _api: 2 | 3 | Wikipedia Documentation 4 | *********************** 5 | 6 | Here you can find the full developer API for the wikipedia project. 7 | 8 | Contents: 9 | 10 | .. toctree:: 11 | 12 | code 13 | 14 | .. automodule:: wikipedia 15 | :members: 16 | 17 | Functions and Classes 18 | =============================== 19 | 20 | .. automodule:: wikipedia 21 | 22 | .. autofunction:: search(query, results=10, suggestion=False) 23 | 24 | .. autofunction:: suggest(query) 25 | 26 | .. autofunction:: summary(query, sentences=0, chars=0, auto_suggest=True, redirect=True) 27 | 28 | .. autofunction:: page 29 | 30 | .. autofunction:: geosearch(latitude, longitude, title=None, results=10, radius=1000) 31 | 32 | .. autoclass:: wikipedia.WikipediaPage 33 | :members: 34 | 35 | .. autofunction:: wikipedia.languages 36 | 37 | .. autofunction:: wikipedia.set_lang 38 | 39 | .. autofunction:: wikipedia.set_rate_limiting 40 | 41 | .. autofunction:: wikipedia.random 42 | 43 | .. autofunction:: wikipedia.donate 44 | 45 | Exceptions 46 | ========== 47 | 48 | .. automodule:: wikipedia.exceptions 49 | :members: 50 | 51 | Indices and tables 52 | ================== 53 | 54 | * :ref:`genindex` 55 | * :ref:`modindex` 56 | * :ref:`search` -------------------------------------------------------------------------------- /setup.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | import codecs 3 | import os 4 | import re 5 | import setuptools 6 | 7 | 8 | def local_file(file): 9 | return codecs.open( 10 | os.path.join(os.path.dirname(__file__), file), 'r', 'utf-8' 11 | ) 12 | 13 | install_reqs = [ 14 | line.strip() 15 | for line in local_file('requirements.txt').readlines() 16 | if line.strip() != '' 17 | ] 18 | 19 | version = re.search( 20 | "^__version__ = \((\d+), (\d+), (\d+)\)$", 21 | local_file('wikipedia/__init__.py').read(), 22 | re.MULTILINE 23 | ).groups() 24 | 25 | 26 | setuptools.setup( 27 | name = "wikipedia", 28 | version = '.'.join(version), 29 | author = "Jonathan Goldsmith", 30 | author_email = "jhghank@gmail.com", 31 | description = "Wikipedia API for Python", 32 | license = "MIT", 33 | keywords = "python wikipedia API", 34 | url = "https://github.com/goldsmith/Wikipedia", 35 | install_requires = install_reqs, 36 | packages = ['wikipedia'], 37 | long_description = local_file('README.rst').read(), 38 | classifiers = [ 39 | 'Development Status :: 4 - Beta', 40 | 'Topic :: Software Development :: Libraries', 41 | 'License :: OSI Approved :: MIT License', 42 | 'Programming Language :: Python', 43 | 'Programming Language :: Python :: 3' 44 | ] 45 | ) 46 | -------------------------------------------------------------------------------- /tests/search_test.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | import unittest 3 | 4 | from collections import defaultdict 5 | 6 | from wikipedia import wikipedia 7 | from request_mock_data import mock_data 8 | 9 | 10 | # mock out _wiki_request 11 | class _wiki_request(object): 12 | 13 | calls = defaultdict(int) 14 | 15 | @classmethod 16 | def __call__(cls, params): 17 | cls.calls[params.__str__()] += 1 18 | return mock_data["_wiki_request calls"][tuple(sorted(params.items()))] 19 | 20 | wikipedia._wiki_request = _wiki_request() 21 | 22 | 23 | class TestSearch(unittest.TestCase): 24 | """Test the functionality of wikipedia.search.""" 25 | 26 | def test_search(self): 27 | """Test parsing a Wikipedia request result.""" 28 | self.assertEqual(wikipedia.search("Barack Obama"), mock_data['data']["barack.search"]) 29 | 30 | def test_limit(self): 31 | """Test limiting a request results.""" 32 | self.assertEqual(wikipedia.search("Porsche", results=3), mock_data['data']["porsche.search"]) 33 | 34 | def test_suggestion(self): 35 | """Test getting a suggestion as well as search results.""" 36 | search, suggestion = wikipedia.search("hallelulejah", suggestion=True) 37 | self.assertEqual(search, []) 38 | self.assertEqual(suggestion, u'hallelujah') 39 | 40 | def test_suggestion_none(self): 41 | """Test getting a suggestion when there is no suggestion.""" 42 | search, suggestion = wikipedia.search("qmxjsudek", suggestion=True) 43 | self.assertEqual(search, []) 44 | self.assertEqual(suggestion, None) 45 | -------------------------------------------------------------------------------- /tests/geosearch_test.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | import unittest 3 | 4 | from collections import defaultdict 5 | from decimal import Decimal 6 | 7 | from wikipedia import wikipedia 8 | from request_mock_data import mock_data 9 | 10 | 11 | # mock out _wiki_request 12 | class _wiki_request(object): 13 | 14 | calls = defaultdict(int) 15 | 16 | @classmethod 17 | def __call__(cls, params): 18 | cls.calls[params.__str__()] += 1 19 | return mock_data["_wiki_request calls"][tuple(sorted(params.items()))] 20 | 21 | wikipedia._wiki_request = _wiki_request() 22 | 23 | 24 | class TestSearchLoc(unittest.TestCase): 25 | """Test the functionality of wikipedia.geosearch.""" 26 | 27 | def test_geosearch(self): 28 | """Test parsing a Wikipedia location request result.""" 29 | self.assertEqual( 30 | wikipedia.geosearch(Decimal('40.67693'), Decimal('117.23193')), 31 | mock_data['data']["great_wall_of_china.geo_seach"] 32 | ) 33 | 34 | def test_geosearch_with_radius(self): 35 | """Test parsing a Wikipedia location request result.""" 36 | self.assertEqual(wikipedia.geosearch( 37 | Decimal('40.67693'), Decimal('117.23193'), radius=10000), 38 | mock_data['data']["great_wall_of_china.geo_seach_with_radius"] 39 | ) 40 | 41 | def test_geosearch_with_existing_title(self): 42 | """Test parsing a Wikipedia location request result.""" 43 | self.assertEqual(wikipedia.geosearch( 44 | Decimal('40.67693'), Decimal('117.23193'), title='Great Wall of China'), 45 | mock_data['data']["great_wall_of_china.geo_seach_with_existing_article_name"] 46 | ) 47 | 48 | def test_geosearch_with_non_existing_title(self): 49 | self.assertEqual(wikipedia.geosearch( 50 | Decimal('40.67693'), Decimal('117.23193'), title='Test'), 51 | mock_data['data']["great_wall_of_china.geo_seach_with_non_existing_article_name"] 52 | ) -------------------------------------------------------------------------------- /wikipedia/exceptions.py: -------------------------------------------------------------------------------- 1 | """ 2 | Global wikipedia exception and warning classes. 3 | """ 4 | 5 | import sys 6 | 7 | 8 | ODD_ERROR_MESSAGE = "This shouldn't happen. Please report on GitHub: github.com/goldsmith/Wikipedia" 9 | 10 | 11 | class WikipediaException(Exception): 12 | """Base Wikipedia exception class.""" 13 | 14 | def __init__(self, error): 15 | self.error = error 16 | 17 | def __unicode__(self): 18 | return "An unknown error occured: \"{0}\". Please report it on GitHub!".format(self.error) 19 | 20 | if sys.version_info > (3, 0): 21 | def __str__(self): 22 | return self.__unicode__() 23 | 24 | else: 25 | def __str__(self): 26 | return self.__unicode__().encode('utf8') 27 | 28 | 29 | class PageError(WikipediaException): 30 | """Exception raised when no Wikipedia matched a query.""" 31 | 32 | def __init__(self, pageid=None, *args): 33 | if pageid: 34 | self.pageid = pageid 35 | else: 36 | self.title = args[0] 37 | 38 | def __unicode__(self): 39 | if hasattr(self, 'title'): 40 | return u"\"{0}\" does not match any pages. Try another query!".format(self.title) 41 | else: 42 | return u"Page id \"{0}\" does not match any pages. Try another id!".format(self.pageid) 43 | 44 | 45 | class DisambiguationError(WikipediaException): 46 | """ 47 | Exception raised when a page resolves to a Disambiguation page. 48 | 49 | The `options` property contains a list of titles 50 | of Wikipedia pages that the query may refer to. 51 | 52 | .. note:: `options` does not include titles that do not link to a valid Wikipedia page. 53 | """ 54 | 55 | def __init__(self, title, may_refer_to): 56 | self.title = title 57 | self.options = may_refer_to 58 | 59 | def __unicode__(self): 60 | return u"\"{0}\" may refer to: \n{1}".format(self.title, '\n'.join(self.options)) 61 | 62 | 63 | class RedirectError(WikipediaException): 64 | """Exception raised when a page title unexpectedly resolves to a redirect.""" 65 | 66 | def __init__(self, title): 67 | self.title = title 68 | 69 | def __unicode__(self): 70 | return u"\"{0}\" resulted in a redirect. Set the redirect property to True to allow automatic redirects.".format(self.title) 71 | 72 | 73 | class HTTPTimeoutError(WikipediaException): 74 | """Exception raised when a request to the Mediawiki servers times out.""" 75 | 76 | def __init__(self, query): 77 | self.query = query 78 | 79 | def __unicode__(self): 80 | return u"Searching for \"{0}\" resulted in a timeout. Try again in a few seconds, and make sure you have rate limiting set to True.".format(self.query) 81 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | ## Current 4 | 5 | ## Version 1.4 6 | 7 | * Test wikipdia library on Python v3.4. PR [#52](https://github.com/goldsmith/Wikipedia/pull/52) by [frewsxcv](https://github.com/frewsxcv) 8 | * Add WikipediaPage.categories attribute. PR [#59](https://github.com/goldsmith/Wikipedia/pull/59) by [@willf](https://github.com/willf) 9 | 10 | ### Version 1.3.1 11 | 12 | * Determine package version without importing ``wikipedia`` in setup.py. Fixes [#50](https://github.com/goldsmith/Wikipedia/issues/50) reported by [@arcolife](https://github.com/arcolife) 13 | 14 | * Update ``requests`` dependency to v2.3.0 15 | 16 | ## Version 1.3 17 | 18 | * wikipedia.languages() for easy access to all language prefixes 19 | * Conditional check for normalization in redirect queries. Fixes [#47](https://github.com/goldsmith/Wikipedia/issues/47) 20 | * Remove pip requirement to fix pip installation error. Fixes [#46](https://github.com/goldsmith/Wikipedia/issues/46#issuecomment-44221725) reported by [@oquidav](https://github.com/oquidave) 21 | 22 | ### Version 1.2.1 23 | 24 | * Refactor query functions to standardize & fix functionality of WikipediaPage properties that return a list. Fixes [#38](https://github.com/goldsmith/Wikipedia/issues/38) reported by [@gwezerek](https://github.com/gwezerek) 25 | 26 | * Use official Mediawiki API 'redirects' key to avoid redirection parse errors. Fixes [#28](https://github.com/goldsmith/Wikipedia/issues/28) 27 | reported by [@shichao-an](https://github.com/shichao-an) and [#32](https://github.com/goldsmith/Wikipedia/issues/32) reported by [@dmirylenka](https://github.com/dmirylenka) 28 | 29 | ## Version 1.2 30 | 31 | * Add revision_id and parent_id properties. PR [#23](https://github.com/goldsmith/Wikipedia/pull/23) by [@fusiongyro](https://github.com/fusiongyro) 32 | * Add changeable User-Agent. PR [#33](https://github.com/goldsmith/Wikipedia/pull/33) by [@crazybmanp](https://github.com/crazybmanp) 33 | * Add geosearch functionality. PR [#40](https://github.com/goldsmith/Wikipedia/pull/40) by [@Kazuar](https://github.com/Kazuar) 34 | 35 | ## Version 1.1 36 | 37 | * Add limited ability to access section titles on a page. PR [#18](https://github.com/goldsmith/Wikipedia/pull/18) by [@astavonin](https://github.com/astavonin) 38 | * Add optional rate limiting. Closes issue [#20](https://github.com/goldsmith/Wikipedia/pull/20) reported by [@mobeets](https://github.com/mobeets) 39 | * Add HTTPTimeout exception 40 | 41 | ### Version 1.0.2 42 | 43 | * Fix installation issue on some Python 3 machines. Closes issue [#15](https://github.com/goldsmith/Wikipedia/issues/15) by [@wronglink](https://github.com/wronglink) 44 | * Add Python 3 support on PyPI 45 | 46 | ## Version 1.0 47 | 48 | * Add international support 49 | * Fix continue values with Mediawiki API 50 | * Support Python 3 51 | 52 | ### Version 0.9 53 | 54 | * Initial functionality 55 | * Add documentation and upload to ReadTheDocs 56 | -------------------------------------------------------------------------------- /README.rst: -------------------------------------------------------------------------------- 1 | Wikipedia 2 | ========= 3 | 4 | .. image:: https://travis-ci.org/goldsmith/Wikipedia.png?branch=master 5 | :target: https://travis-ci.org/goldsmith/Wikipedia 6 | .. image:: https://pypip.in/d/wikipedia/badge.png 7 | :target: https://crate.io/packages/wikipedia 8 | .. image:: https://pypip.in/v/wikipedia/badge.png 9 | :target: https://crate.io/packages/wikipedia 10 | .. image:: https://pypip.in/license/wikipedia/badge.png 11 | :target: https://pypi.python.org/pypi/wikipedia/ 12 | :alt: License 13 | 14 | **Wikipedia** is a Python library that makes it easy to access and parse 15 | data from Wikipedia. 16 | 17 | Search Wikipedia, get article summaries, get data like links and images 18 | from a page, and more. Wikipedia wraps the `MediaWiki 19 | API `__ so you can focus on using 20 | Wikipedia data, not getting it. 21 | 22 | .. code:: python 23 | 24 | >>> import wikipedia 25 | >>> print wikipedia.summary("Wikipedia") 26 | # Wikipedia (/ˌwɪkɨˈpiːdiə/ or /ˌwɪkiˈpiːdiə/ WIK-i-PEE-dee-ə) is a collaboratively edited, multilingual, free Internet encyclopedia supported by the non-profit Wikimedia Foundation... 27 | 28 | >>> wikipedia.search("Barack") 29 | # [u'Barak (given name)', u'Barack Obama', u'Barack (brandy)', u'Presidency of Barack Obama', u'Family of Barack Obama', u'First inauguration of Barack Obama', u'Barack Obama presidential campaign, 2008', u'Barack Obama, Sr.', u'Barack Obama citizenship conspiracy theories', u'Presidential transition of Barack Obama'] 30 | 31 | >>> ny = wikipedia.page("New York") 32 | >>> ny.title 33 | # u'New York' 34 | >>> ny.url 35 | # u'http://en.wikipedia.org/wiki/New_York' 36 | >>> ny.content 37 | # u'New York is a state in the Northeastern region of the United States. New York is the 27th-most exten'... 38 | >>> ny.links[0] 39 | # u'1790 United States Census' 40 | 41 | >>> wikipedia.set_lang("fr") 42 | >>> wikipedia.summary("Facebook", sentences=1) 43 | # Facebook est un service de réseautage social en ligne sur Internet permettant d'y publier des informations (photographies, liens, textes, etc.) en contrôlant leur visibilité par différentes catégories de personnes. 44 | 45 | Note: this library was designed for ease of use and simplicity, not for advanced use. If you plan on doing serious scraping or automated requests, please use `Pywikipediabot `__ (or one of the other more advanced `Python MediaWiki API wrappers `__), which has a larger API, rate limiting, and other features so we can be considerate of the MediaWiki infrastructure. 46 | 47 | Installation 48 | ------------ 49 | 50 | To install Wikipedia, simply run: 51 | 52 | :: 53 | 54 | $ pip install wikipedia 55 | 56 | Wikipedia is compatible with Python 2.6+ (2.7+ to run unittest discover) and Python 3.3+. 57 | 58 | Documentation 59 | ------------- 60 | 61 | Read the docs at https://wikipedia.readthedocs.org/en/latest/. 62 | 63 | - `Quickstart `__ 64 | - `Full API `__ 65 | 66 | To run tests, clone the `repository on GitHub `__, then run: 67 | 68 | :: 69 | 70 | $ pip install -r requirements.txt 71 | $ bash runtests # will run tests for python and python3 72 | $ python -m unittest discover tests/ '*test.py' # manual style 73 | 74 | in the root project directory. 75 | 76 | To build the documentation yourself, after installing requirements.txt, run: 77 | 78 | :: 79 | 80 | $ pip install sphinx 81 | $ cd docs/ 82 | $ make html 83 | 84 | License 85 | ------- 86 | 87 | MIT licensed. See the `LICENSE 88 | file `__ for 89 | full details. 90 | 91 | Credits 92 | ------- 93 | 94 | - `wiki-api `__ by 95 | @richardasaurus for inspiration 96 | - @nmoroze and @themichaelyang for feedback and suggestions 97 | - The `Wikimedia 98 | Foundation `__ for giving 99 | the world free access to data 100 | 101 | 102 | 103 | .. image:: https://d2weczhvl823v0.cloudfront.net/goldsmith/wikipedia/trend.png 104 | :alt: Bitdeli badge 105 | :target: https://bitdeli.com/free 106 | 107 | -------------------------------------------------------------------------------- /docs/source/quickstart.rst: -------------------------------------------------------------------------------- 1 | .. _quickstart: 2 | 3 | Quickstart 4 | ********** 5 | 6 | Start using wikipedia for Python in less than 5 minutes! If you are looking for the the full developer API, see :ref:`api`. 7 | 8 | Begin by installing wikipedia:: 9 | 10 | $ pip install wikipedia 11 | 12 | Now let's use search and suggestion. 13 | 14 | As you might guess, 15 | ``wikipedia.search`` does a Wikipedia search for a query, 16 | and ``wikipedia.suggest`` returns the suggested Wikipedia title for a query, or ``None``:: 17 | 18 | >>> import wikipedia 19 | 20 | >>> wikipedia.search("Barack") 21 | [u'Barak (given name)', u'Barack Obama', u'Barack (brandy)', u'Presidency of Barack Obama', u'Family of Barack Obama', u'First inauguration of Barack Obama', u'Barack Obama presidential campaign, 2008', u'Barack Obama, Sr.', u'Barack Obama citizenship conspiracy theories', u'Presidential transition of Barack Obama'] 22 | 23 | >>> wikipedia.suggest("Barak Obama") 24 | u'Barack Obama' 25 | 26 | We can also get fewer or more results by using the ``results`` kwarg:: 27 | 28 | >>> wikipedia.search("Ford", results=3) 29 | [u'Ford Motor Company', u'Gerald Ford', u'Henry Ford'] 30 | 31 | To get the summary of an article, use ``wikipedia.summary``:: 32 | 33 | >>> wikipedia.summary("GitHub") 34 | 2011, GitHub was the most popular open source code repository site.\nGitHub Inc. was founded in 2008 and is based in San Francisco, California.\nIn July 2012, the company received $100 million in Series A funding, primarily from Andreessen Horowitz.' 35 | 36 | >>> wikipedia.summary("Apple III", sentences=1) 37 | u'The Apple III (often rendered as Apple ///) is a business-oriented personal computer produced and released by Apple Computer that was intended as the successor to the Apple II series, but largely considered a failure in the market. ' 38 | 39 | But watch out - ``wikipedia.summary`` will raise a ``DisambiguationError`` if the page is a disambiguation page, or a ``PageError`` if the page doesn't exist (although by default, it tries to find the page you meant with ``suggest`` and ``search``.):: 40 | 41 | >>> wikipedia.summary("Mercury") 42 | Traceback (most recent call last): 43 | ... 44 | wikipedia.exceptions.DisambiguationError: "Mercury" may refer to: 45 | Mercury (mythology) 46 | Mercury (planet) 47 | Mercury (element) 48 | 49 | >>> try: 50 | ... mercury = wikipedia.summary("Mercury") 51 | ... except wikipedia.exceptions.DisambiguationError as e: 52 | ... print e.options 53 | ... 54 | [u'Mercury (mythology)', u'Mercury (planet)', u'Mercury (element)', u'Mercury, Nevada', ...] 55 | 56 | >>> wikipedia.summary("zvv") 57 | Traceback (most recent call last): 58 | ... 59 | wikipedia.exceptions.PageError: "zvv" does not match any pages. Try another query! 60 | 61 | ``wikipedia.page`` enables you to load and access data from full Wikipedia pages. Initialize with a page title (keep in mind the errors listed above), and then access most properties using property methods:: 62 | 63 | >>> ny = wikipedia.page("New York") 64 | 65 | >>> ny.title 66 | u'New York' 67 | 68 | >>> ny.url 69 | u'http://en.wikipedia.org/wiki/NewYork' 70 | 71 | >>> ny.content 72 | u'New York is a state in the Northeastern region of the United States. New York is the 27th-most exten'... 73 | 74 | >>> ny.images[0] 75 | u'http://upload.wikimedia.org/wikipedia/commons/9/91/New_York_quarter%2C_reverse_side%2C_2001.jpg' 76 | 77 | >>> ny.links[0] 78 | u'1790 United States Census' 79 | 80 | To change the language of the Wikipedia you are accessing, use ``wikipedia.set_lang``. Remember to search for page titles in the language that you have set, not English!:: 81 | 82 | >>> wikipedia.set_lang("fr") 83 | 84 | >>> print wikipedia.summary("Francois Hollande") 85 | François Hollande, né le 12 août 1954 à Rouen, en Seine-Maritime, est un homme d'État français. Il est président de la République française depuis le 15 mai 2012... 86 | 87 | To get a list of all possible language prefixes, try: 88 | 89 | >>> 'en' in wikipedia.languages() 90 | True 91 | >>> print wikipedia.languages()['es'] 92 | español 93 | 94 | Finally, the last method you're going to want to know in the wikipedia module is ``wikipedia.donate``:: 95 | 96 | >>> wikipedia.donate() 97 | # your favorite web browser will open to the donations page of the Wikimedia project 98 | # because without them, none of this would be possible 99 | 100 | See :ref:`api` for a full reference to the rest of the arguments and methods you can use! 101 | 102 | Indices and tables 103 | ================== 104 | 105 | * :ref:`genindex` 106 | * :ref:`modindex` 107 | * :ref:`search` 108 | -------------------------------------------------------------------------------- /docs/source/_themes/flask_small/static/flasky.css_t: -------------------------------------------------------------------------------- 1 | /* 2 | * flasky.css_t 3 | * ~~~~~~~~~~~~ 4 | * 5 | * Sphinx stylesheet -- flasky theme based on nature theme. 6 | * 7 | * :copyright: Copyright 2007-2010 by the Sphinx team, see AUTHORS. 8 | * :license: BSD, see LICENSE for details. 9 | * 10 | */ 11 | 12 | @import url("basic.css"); 13 | 14 | /* -- page layout ----------------------------------------------------------- */ 15 | 16 | body { 17 | font-family: 'Georgia', serif; 18 | font-size: 17px; 19 | color: #000; 20 | background: white; 21 | margin: 0; 22 | padding: 0; 23 | } 24 | 25 | div.documentwrapper { 26 | float: left; 27 | width: 100%; 28 | } 29 | 30 | div.bodywrapper { 31 | margin: 40px auto 0 auto; 32 | width: 50%; 33 | } 34 | 35 | hr { 36 | border: 1px solid #B1B4B6; 37 | } 38 | 39 | div.body { 40 | background-color: #ffffff; 41 | color: #3E4349; 42 | padding: 0 30px 30px 30px; 43 | } 44 | 45 | img.floatingflask { 46 | padding: 0 0 10px 10px; 47 | float: right; 48 | } 49 | 50 | div.footer { 51 | text-align: right; 52 | color: #888; 53 | padding: 10px; 54 | font-size: 14px; 55 | width: 650px; 56 | margin: 0 auto 40px auto; 57 | } 58 | 59 | div.footer a { 60 | color: #888; 61 | text-decoration: underline; 62 | } 63 | 64 | div.related { 65 | line-height: 32px; 66 | color: #888; 67 | } 68 | 69 | div.related ul { 70 | padding: 0 0 0 10px; 71 | } 72 | 73 | div.related a { 74 | color: #444; 75 | } 76 | 77 | /* -- body styles ----------------------------------------------------------- */ 78 | 79 | a { 80 | color: #004B6B; 81 | text-decoration: underline; 82 | } 83 | 84 | a:hover { 85 | color: #6D4100; 86 | text-decoration: underline; 87 | } 88 | 89 | div.body { 90 | padding-bottom: 40px; /* saved for footer */ 91 | } 92 | 93 | div.body h1, 94 | div.body h2, 95 | div.body h3, 96 | div.body h4, 97 | div.body h5, 98 | div.body h6 { 99 | font-family: 'Garamond', 'Georgia', serif; 100 | font-weight: normal; 101 | margin: 30px 0px 10px 0px; 102 | padding: 0; 103 | } 104 | 105 | {% if theme_index_logo %} 106 | div.indexwrapper h1 { 107 | text-indent: -999999px; 108 | background: url({{ theme_index_logo }}) no-repeat center center; 109 | height: {{ theme_index_logo_height }}; 110 | } 111 | {% endif %} 112 | 113 | div.body h2 { font-size: 180%; } 114 | div.body h3 { font-size: 150%; } 115 | div.body h4 { font-size: 130%; } 116 | div.body h5 { font-size: 100%; } 117 | div.body h6 { font-size: 100%; } 118 | 119 | a.headerlink { 120 | color: white; 121 | padding: 0 4px; 122 | text-decoration: none; 123 | } 124 | 125 | a.headerlink:hover { 126 | color: #444; 127 | background: #eaeaea; 128 | } 129 | 130 | div.body p, div.body dd, div.body li { 131 | line-height: 1.4em; 132 | } 133 | 134 | div.admonition { 135 | background: #fafafa; 136 | margin: 20px -30px; 137 | padding: 10px 30px; 138 | border-top: 1px solid #ccc; 139 | border-bottom: 1px solid #ccc; 140 | } 141 | 142 | div.admonition p.admonition-title { 143 | font-family: 'Garamond', 'Georgia', serif; 144 | font-weight: normal; 145 | font-size: 24px; 146 | margin: 0 0 10px 0; 147 | padding: 0; 148 | line-height: 1; 149 | } 150 | 151 | div.admonition p.last { 152 | margin-bottom: 0; 153 | } 154 | 155 | div.highlight{ 156 | background-color: white; 157 | } 158 | 159 | dt:target, .highlight { 160 | background: #FAF3E8; 161 | } 162 | 163 | div.note { 164 | background-color: #eee; 165 | border: 1px solid #ccc; 166 | } 167 | 168 | div.seealso { 169 | background-color: #ffc; 170 | border: 1px solid #ff6; 171 | } 172 | 173 | div.topic { 174 | background-color: #eee; 175 | } 176 | 177 | div.warning { 178 | background-color: #ffe4e4; 179 | border: 1px solid #f66; 180 | } 181 | 182 | p.admonition-title { 183 | display: inline; 184 | } 185 | 186 | p.admonition-title:after { 187 | content: ":"; 188 | } 189 | 190 | pre, tt { 191 | font-family: 'Consolas', 'Menlo', 'Deja Vu Sans Mono', 'Bitstream Vera Sans Mono', monospace; 192 | font-size: 0.85em; 193 | } 194 | 195 | img.screenshot { 196 | } 197 | 198 | tt.descname, tt.descclassname { 199 | font-size: 0.95em; 200 | } 201 | 202 | tt.descname { 203 | padding-right: 0.08em; 204 | } 205 | 206 | img.screenshot { 207 | -moz-box-shadow: 2px 2px 4px #eee; 208 | -webkit-box-shadow: 2px 2px 4px #eee; 209 | box-shadow: 2px 2px 4px #eee; 210 | } 211 | 212 | table.docutils { 213 | border: 1px solid #888; 214 | -moz-box-shadow: 2px 2px 4px #eee; 215 | -webkit-box-shadow: 2px 2px 4px #eee; 216 | box-shadow: 2px 2px 4px #eee; 217 | } 218 | 219 | table.docutils td, table.docutils th { 220 | border: 1px solid #888; 221 | padding: 0.25em 0.7em; 222 | } 223 | 224 | table.field-list, table.footnote { 225 | border: none; 226 | -moz-box-shadow: none; 227 | -webkit-box-shadow: none; 228 | box-shadow: none; 229 | } 230 | 231 | table.footnote { 232 | margin: 15px 0; 233 | width: 100%; 234 | border: 1px solid #eee; 235 | } 236 | 237 | table.field-list th { 238 | padding: 0 0.8em 0 0; 239 | } 240 | 241 | table.field-list td { 242 | padding: 0; 243 | } 244 | 245 | table.footnote td { 246 | padding: 0.5em; 247 | } 248 | 249 | dl { 250 | margin: 0; 251 | padding: 0; 252 | } 253 | 254 | dl dd { 255 | margin-left: 30px; 256 | } 257 | 258 | pre { 259 | padding: 0; 260 | margin: 15px -30px; 261 | padding: 8px; 262 | line-height: 1.3em; 263 | padding: 7px 30px; 264 | background: #eee; 265 | border-radius: 2px; 266 | -moz-border-radius: 2px; 267 | -webkit-border-radius: 2px; 268 | } 269 | 270 | dl pre { 271 | margin-left: -60px; 272 | padding-left: 60px; 273 | } 274 | 275 | tt { 276 | background-color: #ecf0f3; 277 | color: #222; 278 | /* padding: 1px 2px; */ 279 | } 280 | 281 | tt.xref, a tt { 282 | background-color: #FBFBFB; 283 | } 284 | 285 | a:hover tt { 286 | background: #EEE; 287 | } 288 | -------------------------------------------------------------------------------- /docs/Makefile: -------------------------------------------------------------------------------- 1 | # Makefile for Sphinx documentation 2 | # 3 | 4 | # You can set these variables from the command line. 5 | SPHINXOPTS = 6 | SPHINXBUILD = sphinx-build 7 | PAPER = 8 | BUILDDIR = build 9 | 10 | # User-friendly check for sphinx-build 11 | ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1) 12 | $(error The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the full path of the '$(SPHINXBUILD)' executable. Alternatively you can add the directory with the executable to your PATH. If you don't have Sphinx installed, grab it from http://sphinx-doc.org/) 13 | endif 14 | 15 | # Internal variables. 16 | PAPEROPT_a4 = -D latex_paper_size=a4 17 | PAPEROPT_letter = -D latex_paper_size=letter 18 | ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source 19 | # the i18n builder cannot share the environment and doctrees with the others 20 | I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source 21 | 22 | .PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext 23 | 24 | help: 25 | @echo "Please use \`make ' where is one of" 26 | @echo " html to make standalone HTML files" 27 | @echo " dirhtml to make HTML files named index.html in directories" 28 | @echo " singlehtml to make a single large HTML file" 29 | @echo " pickle to make pickle files" 30 | @echo " json to make JSON files" 31 | @echo " htmlhelp to make HTML files and a HTML help project" 32 | @echo " qthelp to make HTML files and a qthelp project" 33 | @echo " devhelp to make HTML files and a Devhelp project" 34 | @echo " epub to make an epub" 35 | @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter" 36 | @echo " latexpdf to make LaTeX files and run them through pdflatex" 37 | @echo " latexpdfja to make LaTeX files and run them through platex/dvipdfmx" 38 | @echo " text to make text files" 39 | @echo " man to make manual pages" 40 | @echo " texinfo to make Texinfo files" 41 | @echo " info to make Texinfo files and run them through makeinfo" 42 | @echo " gettext to make PO message catalogs" 43 | @echo " changes to make an overview of all changed/added/deprecated items" 44 | @echo " xml to make Docutils-native XML files" 45 | @echo " pseudoxml to make pseudoxml-XML files for display purposes" 46 | @echo " linkcheck to check all external links for integrity" 47 | @echo " doctest to run all doctests embedded in the documentation (if enabled)" 48 | 49 | clean: 50 | rm -rf $(BUILDDIR)/* 51 | 52 | html: 53 | $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html 54 | @echo 55 | @echo "Build finished. The HTML pages are in $(BUILDDIR)/html." 56 | 57 | dirhtml: 58 | $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml 59 | @echo 60 | @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml." 61 | 62 | singlehtml: 63 | $(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml 64 | @echo 65 | @echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml." 66 | 67 | pickle: 68 | $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle 69 | @echo 70 | @echo "Build finished; now you can process the pickle files." 71 | 72 | json: 73 | $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json 74 | @echo 75 | @echo "Build finished; now you can process the JSON files." 76 | 77 | htmlhelp: 78 | $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp 79 | @echo 80 | @echo "Build finished; now you can run HTML Help Workshop with the" \ 81 | ".hhp project file in $(BUILDDIR)/htmlhelp." 82 | 83 | qthelp: 84 | $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp 85 | @echo 86 | @echo "Build finished; now you can run "qcollectiongenerator" with the" \ 87 | ".qhcp project file in $(BUILDDIR)/qthelp, like this:" 88 | @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/wikipedia.qhcp" 89 | @echo "To view the help file:" 90 | @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/wikipedia.qhc" 91 | 92 | devhelp: 93 | $(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp 94 | @echo 95 | @echo "Build finished." 96 | @echo "To view the help file:" 97 | @echo "# mkdir -p $$HOME/.local/share/devhelp/wikipedia" 98 | @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/wikipedia" 99 | @echo "# devhelp" 100 | 101 | epub: 102 | $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub 103 | @echo 104 | @echo "Build finished. The epub file is in $(BUILDDIR)/epub." 105 | 106 | latex: 107 | $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex 108 | @echo 109 | @echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex." 110 | @echo "Run \`make' in that directory to run these through (pdf)latex" \ 111 | "(use \`make latexpdf' here to do that automatically)." 112 | 113 | latexpdf: 114 | $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex 115 | @echo "Running LaTeX files through pdflatex..." 116 | $(MAKE) -C $(BUILDDIR)/latex all-pdf 117 | @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." 118 | 119 | latexpdfja: 120 | $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex 121 | @echo "Running LaTeX files through platex and dvipdfmx..." 122 | $(MAKE) -C $(BUILDDIR)/latex all-pdf-ja 123 | @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." 124 | 125 | text: 126 | $(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text 127 | @echo 128 | @echo "Build finished. The text files are in $(BUILDDIR)/text." 129 | 130 | man: 131 | $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man 132 | @echo 133 | @echo "Build finished. The manual pages are in $(BUILDDIR)/man." 134 | 135 | texinfo: 136 | $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo 137 | @echo 138 | @echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo." 139 | @echo "Run \`make' in that directory to run these through makeinfo" \ 140 | "(use \`make info' here to do that automatically)." 141 | 142 | info: 143 | $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo 144 | @echo "Running Texinfo files through makeinfo..." 145 | make -C $(BUILDDIR)/texinfo info 146 | @echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo." 147 | 148 | gettext: 149 | $(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale 150 | @echo 151 | @echo "Build finished. The message catalogs are in $(BUILDDIR)/locale." 152 | 153 | changes: 154 | $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes 155 | @echo 156 | @echo "The overview file is in $(BUILDDIR)/changes." 157 | 158 | linkcheck: 159 | $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck 160 | @echo 161 | @echo "Link check complete; look for any errors in the above output " \ 162 | "or in $(BUILDDIR)/linkcheck/output.txt." 163 | 164 | doctest: 165 | $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest 166 | @echo "Testing of doctests in the sources finished, look at the " \ 167 | "results in $(BUILDDIR)/doctest/output.txt." 168 | 169 | xml: 170 | $(SPHINXBUILD) -b xml $(ALLSPHINXOPTS) $(BUILDDIR)/xml 171 | @echo 172 | @echo "Build finished. The XML files are in $(BUILDDIR)/xml." 173 | 174 | pseudoxml: 175 | $(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) $(BUILDDIR)/pseudoxml 176 | @echo 177 | @echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml." 178 | -------------------------------------------------------------------------------- /tests/page_test.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | from decimal import Decimal 3 | import unittest 4 | 5 | from wikipedia import wikipedia 6 | from request_mock_data import mock_data 7 | 8 | 9 | # mock out _wiki_request 10 | def _wiki_request(params): 11 | return mock_data["_wiki_request calls"][tuple(sorted(params.items()))] 12 | wikipedia._wiki_request = _wiki_request 13 | 14 | 15 | class TestPageSetUp(unittest.TestCase): 16 | """Test the functionality of wikipedia.page's __init__ and load functions.""" 17 | 18 | def test_missing(self): 19 | """Test that page raises a PageError for a nonexistant page.""" 20 | # Callicarpa? 21 | purpleberry = lambda: wikipedia.page("purpleberry", auto_suggest=False) 22 | self.assertRaises(wikipedia.PageError, purpleberry) 23 | 24 | def test_redirect_true(self): 25 | """Test that a page successfully redirects a query.""" 26 | # no error should be raised if redirect is test_redirect_true 27 | mp = wikipedia.page("Menlo Park, New Jersey") 28 | 29 | self.assertEqual(mp.title, "Edison, New Jersey") 30 | self.assertEqual(mp.url, "http://en.wikipedia.org/wiki/Edison,_New_Jersey") 31 | 32 | def test_redirect_false(self): 33 | """Test that page raises an error on a redirect when redirect == False.""" 34 | mp = lambda: wikipedia.page("Menlo Park, New Jersey", auto_suggest=False, redirect=False) 35 | self.assertRaises(wikipedia.RedirectError, mp) 36 | 37 | def test_redirect_no_normalization(self): 38 | """Test that a page with redirects but no normalization query loads correctly""" 39 | the_party = wikipedia.page("Communist Party", auto_suggest=False) 40 | self.assertIsInstance(the_party, wikipedia.WikipediaPage) 41 | self.assertEqual(the_party.title, "Communist party") 42 | 43 | def test_redirect_with_normalization(self): 44 | """Test that a page redirect with a normalized query loads correctly""" 45 | the_party = wikipedia.page("communist Party", auto_suggest=False) 46 | self.assertIsInstance(the_party, wikipedia.WikipediaPage) 47 | self.assertEqual(the_party.title, "Communist party") 48 | 49 | def test_redirect_normalization(self): 50 | """Test that a page redirect loads correctly with or without a query normalization""" 51 | capital_party = wikipedia.page("Communist Party", auto_suggest=False) 52 | lower_party = wikipedia.page("communist Party", auto_suggest=False) 53 | 54 | self.assertIsInstance(capital_party, wikipedia.WikipediaPage) 55 | self.assertIsInstance(lower_party, wikipedia.WikipediaPage) 56 | self.assertEqual(capital_party.title, "Communist party") 57 | self.assertEqual(capital_party, lower_party) 58 | 59 | def test_disambiguate(self): 60 | """Test that page raises an error when a disambiguation page is reached.""" 61 | try: 62 | ram = wikipedia.page("Dodge Ram (disambiguation)", auto_suggest=False, redirect=False) 63 | error_raised = False 64 | except wikipedia.DisambiguationError as e: 65 | error_raised = True 66 | options = e.options 67 | 68 | self.assertTrue(error_raised) 69 | self.assertEqual(options, [u'Dodge Ramcharger', u'Dodge Ram Van', u'Dodge Mini Ram', u'Dodge Caravan C/V', u'Dodge Caravan C/V', u'Ram C/V', u'Dodge Ram 50', u'Dodge D-Series', u'Dodge Rampage', u'Ram (brand)']) 70 | 71 | def test_auto_suggest(self): 72 | """Test that auto_suggest properly corrects a typo.""" 73 | # yum, butter. 74 | butterfly = wikipedia.page("butteryfly") 75 | 76 | self.assertEqual(butterfly.title, "Butterfly") 77 | self.assertEqual(butterfly.url, "http://en.wikipedia.org/wiki/Butterfly") 78 | 79 | 80 | class TestPage(unittest.TestCase): 81 | """Test the functionality of the rest of wikipedia.page.""" 82 | 83 | def setUp(self): 84 | # shortest wikipedia articles with images and sections 85 | self.celtuce = wikipedia.page("Celtuce") 86 | self.cyclone = wikipedia.page("Tropical Depression Ten (2005)") 87 | self.great_wall_of_china = wikipedia.page("Great Wall of China") 88 | 89 | def test_from_page_id(self): 90 | """Test loading from a page id""" 91 | self.assertEqual(self.celtuce, wikipedia.page(pageid=1868108)) 92 | 93 | def test_title(self): 94 | """Test the title.""" 95 | self.assertEqual(self.celtuce.title, "Celtuce") 96 | self.assertEqual(self.cyclone.title, "Tropical Depression Ten (2005)") 97 | 98 | def test_url(self): 99 | """Test the url.""" 100 | self.assertEqual(self.celtuce.url, "http://en.wikipedia.org/wiki/Celtuce") 101 | self.assertEqual(self.cyclone.url, "http://en.wikipedia.org/wiki/Tropical_Depression_Ten_(2005)") 102 | 103 | def test_content(self): 104 | """Test the plain text content.""" 105 | self.assertEqual(self.celtuce.content, mock_data['data']["celtuce.content"]) 106 | self.assertEqual(self.cyclone.content, mock_data['data']["cyclone.content"]) 107 | 108 | def test_revision_id(self): 109 | """Test the revision id.""" 110 | self.assertEqual(self.celtuce.revision_id, mock_data['data']["celtuce.revid"]) 111 | self.assertEqual(self.cyclone.revision_id, mock_data['data']["cyclone.revid"]) 112 | 113 | def test_parent_id(self): 114 | """Test the parent id.""" 115 | self.assertEqual(self.celtuce.parent_id, mock_data['data']["celtuce.parentid"]) 116 | self.assertEqual(self.cyclone.parent_id, mock_data['data']["cyclone.parentid"]) 117 | 118 | 119 | def test_summary(self): 120 | """Test the summary.""" 121 | self.assertEqual(self.celtuce.summary, mock_data['data']["celtuce.summary"]) 122 | self.assertEqual(self.cyclone.summary, mock_data['data']["cyclone.summary"]) 123 | 124 | def test_images(self): 125 | """Test the list of image URLs.""" 126 | self.assertEqual(sorted(self.celtuce.images), mock_data['data']["celtuce.images"]) 127 | self.assertEqual(sorted(self.cyclone.images), mock_data['data']["cyclone.images"]) 128 | 129 | def test_references(self): 130 | """Test the list of reference URLs.""" 131 | self.assertEqual(self.celtuce.references, mock_data['data']["celtuce.references"]) 132 | self.assertEqual(self.cyclone.references, mock_data['data']["cyclone.references"]) 133 | 134 | def test_links(self): 135 | """Test the list of titles of links to Wikipedia pages.""" 136 | self.assertEqual(self.celtuce.links, mock_data['data']["celtuce.links"]) 137 | self.assertEqual(self.cyclone.links, mock_data['data']["cyclone.links"]) 138 | 139 | def test_categories(self): 140 | """Test the list of categories of Wikipedia pages.""" 141 | self.assertEqual(self.celtuce.categories, mock_data['data']["celtuce.categories"]) 142 | self.assertEqual(self.cyclone.categories, mock_data['data']["cyclone.categories"]) 143 | 144 | def test_html(self): 145 | """Test the full HTML method.""" 146 | self.assertEqual(self.celtuce.html(), mock_data['data']["celtuce.html"]) 147 | 148 | def test_sections(self): 149 | """Test the list of section titles.""" 150 | self.assertEqual(sorted(self.cyclone.sections), mock_data['data']["cyclone.sections"]) 151 | 152 | def test_section(self): 153 | """Test text content of a single section.""" 154 | self.assertEqual(self.cyclone.section("Impact"), mock_data['data']["cyclone.section.impact"]) 155 | self.assertEqual(self.cyclone.section("History"), None) 156 | 157 | def test_coordinates(self): 158 | """Test geo coordinates of a page""" 159 | lat, lon = self.great_wall_of_china.coordinates 160 | self.assertEqual(str(lat.quantize(Decimal('1.000'))), mock_data['data']['great_wall_of_china.coordinates.lat']) 161 | self.assertEqual(str(lon.quantize(Decimal('1.000'))), mock_data['data']['great_wall_of_china.coordinates.lon']) 162 | -------------------------------------------------------------------------------- /docs/source/conf.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # wikipedia documentation build configuration file, created by 4 | # sphinx-quickstart on Thu Aug 22 11:23:34 2013. 5 | # 6 | # This file is execfile()d with the current directory set to its containing dir. 7 | # 8 | # Note that not all possible configuration values are present in this 9 | # autogenerated file. 10 | # 11 | # All configuration values have a default; values that are commented out 12 | # serve to show the default. 13 | 14 | import sys, os 15 | 16 | # If extensions (or modules to document with autodoc) are in another directory, 17 | # add these directories to sys.path here. If the directory is relative to the 18 | # documentation root, use os.path.abspath to make it absolute, like shown here. 19 | sys.path.insert(0, os.path.abspath('../..')) 20 | sys.path.append(os.path.abspath('_themes')) 21 | 22 | # -- General configuration ----------------------------------------------------- 23 | 24 | # If your documentation needs a minimal Sphinx version, state it here. 25 | #needs_sphinx = '1.0' 26 | 27 | # Add any Sphinx extension module names here, as strings. They can be extensions 28 | # coming with Sphinx (named 'sphinx.ext.*') or your custom ones. 29 | extensions = ['sphinx.ext.autodoc', 'sphinx.ext.coverage', 'sphinx.ext.ifconfig'] 30 | 31 | # Add any paths that contain templates here, relative to this directory. 32 | templates_path = ['_templates'] 33 | 34 | # The suffix of source filenames. 35 | source_suffix = '.rst' 36 | 37 | # The encoding of source files. 38 | #source_encoding = 'utf-8-sig' 39 | 40 | # The master toctree document. 41 | master_doc = 'index' 42 | 43 | # General information about the project. 44 | project = u'wikipedia' 45 | copyright = u'2013, Jonathan Goldsmith' 46 | 47 | # The version info for the project you're documenting, acts as replacement for 48 | # |version| and |release|, also used in various other places throughout the 49 | # built documents. 50 | # 51 | # The short X.Y version. 52 | version = '0.9' 53 | # The full version, including alpha/beta/rc tags. 54 | release = '0.9' 55 | 56 | # The language for content autogenerated by Sphinx. Refer to documentation 57 | # for a list of supported languages. 58 | #language = None 59 | 60 | # There are two options for replacing |today|: either, you set today to some 61 | # non-false value, then it is used: 62 | #today = '' 63 | # Else, today_fmt is used as the format for a strftime call. 64 | #today_fmt = '%B %d, %Y' 65 | 66 | # List of patterns, relative to source directory, that match files and 67 | # directories to ignore when looking for source files. 68 | exclude_patterns = [] 69 | 70 | # The reST default role (used for this markup: `text`) to use for all documents. 71 | #default_role = None 72 | 73 | # If true, '()' will be appended to :func: etc. cross-reference text. 74 | #add_function_parentheses = True 75 | 76 | # If true, the current module name will be prepended to all description 77 | # unit titles (such as .. function::). 78 | #add_module_names = True 79 | 80 | # If true, sectionauthor and moduleauthor directives will be shown in the 81 | # output. They are ignored by default. 82 | #show_authors = False 83 | 84 | # The name of the Pygments (syntax highlighting) style to use. 85 | pygments_style = 'sphinx' 86 | 87 | # A list of ignored prefixes for module index sorting. 88 | #modindex_common_prefix = [] 89 | 90 | # If true, keep warnings as "system message" paragraphs in the built documents. 91 | #keep_warnings = False 92 | 93 | 94 | # -- Options for HTML output --------------------------------------------------- 95 | 96 | # The theme to use for HTML and HTML Help pages. See the documentation for 97 | # a list of builtin themes. 98 | html_theme = 'flask_small' 99 | 100 | # Theme options are theme-specific and customize the look and feel of a theme 101 | # further. For a list of options available for each theme, see the 102 | # documentation. 103 | #html_theme_options = {} 104 | 105 | # Add any paths that contain custom themes here, relative to this directory. 106 | html_theme_path = ['_themes'] 107 | 108 | # The name for this set of Sphinx documents. If None, it defaults to 109 | # " v documentation". 110 | #html_title = None 111 | 112 | # A shorter title for the navigation bar. Default is the same as html_title. 113 | #html_short_title = None 114 | 115 | # The name of an image file (relative to this directory) to place at the top 116 | # of the sidebar. 117 | #html_logo = None 118 | 119 | # The name of an image file (within the static path) to use as favicon of the 120 | # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 121 | # pixels large. 122 | #html_favicon = None 123 | 124 | # Add any paths that contain custom static files (such as style sheets) here, 125 | # relative to this directory. They are copied after the builtin static files, 126 | # so a file named "default.css" will overwrite the builtin "default.css". 127 | html_static_path = ['_static'] 128 | 129 | # If not '', a 'Last updated on:' timestamp is inserted at every page bottom, 130 | # using the given strftime format. 131 | #html_last_updated_fmt = '%b %d, %Y' 132 | 133 | # If true, SmartyPants will be used to convert quotes and dashes to 134 | # typographically correct entities. 135 | #html_use_smartypants = True 136 | 137 | # Custom sidebar templates, maps document names to template names. 138 | #html_sidebars = {} 139 | 140 | # Additional templates that should be rendered to pages, maps page names to 141 | # template names. 142 | #html_additional_pages = {} 143 | 144 | # If false, no module index is generated. 145 | #html_domain_indices = True 146 | 147 | # If false, no index is generated. 148 | #html_use_index = True 149 | 150 | # If true, the index is split into individual pages for each letter. 151 | #html_split_index = False 152 | 153 | # If true, links to the reST sources are added to the pages. 154 | #html_show_sourcelink = True 155 | 156 | # If true, "Created using Sphinx" is shown in the HTML footer. Default is True. 157 | #html_show_sphinx = True 158 | 159 | # If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. 160 | #html_show_copyright = True 161 | 162 | # If true, an OpenSearch description file will be output, and all pages will 163 | # contain a tag referring to it. The value of this option must be the 164 | # base URL from which the finished HTML is served. 165 | #html_use_opensearch = '' 166 | 167 | # This is the file name suffix for HTML files (e.g. ".xhtml"). 168 | #html_file_suffix = None 169 | 170 | # Output file base name for HTML help builder. 171 | htmlhelp_basename = 'wikipediadoc' 172 | 173 | 174 | # -- Options for LaTeX output -------------------------------------------------- 175 | 176 | latex_elements = { 177 | # The paper size ('letterpaper' or 'a4paper'). 178 | # 'papersize': 'letterpaper', 179 | 180 | # The font size ('10pt', '11pt' or '12pt'). 181 | # 'pointsize': '10pt', 182 | 183 | # Additional stuff for the LaTeX preamble. 184 | # 'preamble': '', 185 | } 186 | 187 | # Grouping the document tree into LaTeX files. List of tuples 188 | # (source start file, target name, title, author, documentclass [howto/manual]). 189 | latex_documents = [ 190 | ('index', 'wikipedia.tex', u'wikipedia Documentation', 191 | u'Jonathan Goldsmith', 'manual'), 192 | ] 193 | 194 | # The name of an image file (relative to this directory) to place at the top of 195 | # the title page. 196 | #latex_logo = None 197 | 198 | # For "manual" documents, if this is true, then toplevel headings are parts, 199 | # not chapters. 200 | #latex_use_parts = False 201 | 202 | # If true, show page references after internal links. 203 | #latex_show_pagerefs = False 204 | 205 | # If true, show URL addresses after external links. 206 | #latex_show_urls = False 207 | 208 | # Documents to append as an appendix to all manuals. 209 | #latex_appendices = [] 210 | 211 | # If false, no module index is generated. 212 | #latex_domain_indices = True 213 | 214 | 215 | # -- Options for manual page output -------------------------------------------- 216 | 217 | # One entry per manual page. List of tuples 218 | # (source start file, name, description, authors, manual section). 219 | man_pages = [ 220 | ('index', 'wikipedia', u'wikipedia Documentation', 221 | [u'Jonathan Goldsmith'], 1) 222 | ] 223 | 224 | # If true, show URL addresses after external links. 225 | #man_show_urls = False 226 | 227 | 228 | # -- Options for Texinfo output ------------------------------------------------ 229 | 230 | # Grouping the document tree into Texinfo files. List of tuples 231 | # (source start file, target name, title, author, 232 | # dir menu entry, description, category) 233 | texinfo_documents = [ 234 | ('index', 'wikipedia', u'wikipedia Documentation', 235 | u'Jonathan Goldsmith', 'wikipedia', 'One line description of project.', 236 | 'Miscellaneous'), 237 | ] 238 | 239 | # Documents to append as an appendix to all manuals. 240 | #texinfo_appendices = [] 241 | 242 | # If false, no module index is generated. 243 | #texinfo_domain_indices = True 244 | 245 | # How to display URL addresses: 'footnote', 'no', or 'inline'. 246 | #texinfo_show_urls = 'footnote' 247 | 248 | # If true, do not generate a @detailmenu in the "Top" node's menu. 249 | #texinfo_no_detailmenu = False 250 | -------------------------------------------------------------------------------- /wikipedia/wikipedia.py: -------------------------------------------------------------------------------- 1 | from __future__ import unicode_literals 2 | 3 | import requests 4 | import time 5 | from bs4 import BeautifulSoup 6 | from datetime import datetime, timedelta 7 | from decimal import Decimal 8 | 9 | from .exceptions import ( 10 | PageError, DisambiguationError, RedirectError, HTTPTimeoutError, 11 | WikipediaException, ODD_ERROR_MESSAGE) 12 | from .util import cache, stdout_encode, debug 13 | import re 14 | 15 | API_URL = 'http://en.wikipedia.org/w/api.php' 16 | RATE_LIMIT = False 17 | RATE_LIMIT_MIN_WAIT = None 18 | RATE_LIMIT_LAST_CALL = None 19 | USER_AGENT = 'wikipedia (https://github.com/goldsmith/Wikipedia/)' 20 | 21 | 22 | def set_lang(prefix): 23 | ''' 24 | Change the language of the API being requested. 25 | Set `prefix` to one of the two letter prefixes found on the `list of all Wikipedias `_. 26 | 27 | After setting the language, the cache for ``search``, ``suggest``, and ``summary`` will be cleared. 28 | 29 | .. note:: Make sure you search for page titles in the language that you have set. 30 | ''' 31 | global API_URL 32 | API_URL = 'http://' + prefix.lower() + '.wikipedia.org/w/api.php' 33 | 34 | for cached_func in (search, suggest, summary): 35 | cached_func.clear_cache() 36 | 37 | 38 | def set_user_agent(user_agent_string): 39 | ''' 40 | Set the User-Agent string to be used for all requests. 41 | 42 | Arguments: 43 | 44 | * user_agent_string - (string) a string specifying the User-Agent header 45 | ''' 46 | global USER_AGENT 47 | USER_AGENT = user_agent_string 48 | 49 | 50 | def set_rate_limiting(rate_limit, min_wait=timedelta(milliseconds=50)): 51 | ''' 52 | Enable or disable rate limiting on requests to the Mediawiki servers. 53 | If rate limiting is not enabled, under some circumstances (depending on 54 | load on Wikipedia, the number of requests you and other `wikipedia` users 55 | are making, and other factors), Wikipedia may return an HTTP timeout error. 56 | 57 | Enabling rate limiting generally prevents that issue, but please note that 58 | HTTPTimeoutError still might be raised. 59 | 60 | Arguments: 61 | 62 | * rate_limit - (Boolean) whether to enable rate limiting or not 63 | 64 | Keyword arguments: 65 | 66 | * min_wait - if rate limiting is enabled, `min_wait` is a timedelta describing the minimum time to wait before requests. 67 | Defaults to timedelta(milliseconds=50) 68 | ''' 69 | global RATE_LIMIT 70 | global RATE_LIMIT_MIN_WAIT 71 | global RATE_LIMIT_LAST_CALL 72 | 73 | RATE_LIMIT = rate_limit 74 | if not rate_limit: 75 | RATE_LIMIT_MIN_WAIT = None 76 | else: 77 | RATE_LIMIT_MIN_WAIT = min_wait 78 | 79 | RATE_LIMIT_LAST_CALL = None 80 | 81 | 82 | @cache 83 | def search(query, results=10, suggestion=False): 84 | ''' 85 | Do a Wikipedia search for `query`. 86 | 87 | Keyword arguments: 88 | 89 | * results - the maxmimum number of results returned 90 | * suggestion - if True, return results and suggestion (if any) in a tuple 91 | ''' 92 | 93 | search_params = { 94 | 'list': 'search', 95 | 'srprop': '', 96 | 'srlimit': results, 97 | 'limit': results, 98 | 'srsearch': query 99 | } 100 | if suggestion: 101 | search_params['srinfo'] = 'suggestion' 102 | 103 | raw_results = _wiki_request(search_params) 104 | 105 | if 'error' in raw_results: 106 | if raw_results['error']['info'] in ('HTTP request timed out.', 'Pool queue is full'): 107 | raise HTTPTimeoutError(query) 108 | else: 109 | raise WikipediaException(raw_results['error']['info']) 110 | 111 | search_results = (d['title'] for d in raw_results['query']['search']) 112 | 113 | if suggestion: 114 | if raw_results['query'].get('searchinfo'): 115 | return list(search_results), raw_results['query']['searchinfo']['suggestion'] 116 | else: 117 | return list(search_results), None 118 | 119 | return list(search_results) 120 | 121 | 122 | @cache 123 | def geosearch(latitude, longitude, title=None, results=10, radius=1000): 124 | ''' 125 | Do a wikipedia geo search for `latitude` and `longitude` 126 | using HTTP API described in http://www.mediawiki.org/wiki/Extension:GeoData 127 | 128 | Arguments: 129 | 130 | * latitude (float or decimal.Decimal) 131 | * longitude (float or decimal.Decimal) 132 | 133 | Keyword arguments: 134 | 135 | * title - The title of an article to search for 136 | * results - the maximum number of results returned 137 | * radius - Search radius in meters. The value must be between 10 and 10000 138 | ''' 139 | 140 | search_params = { 141 | 'list': 'geosearch', 142 | 'gsradius': radius, 143 | 'gscoord': '{0}|{1}'.format(latitude, longitude), 144 | 'gslimit': results 145 | } 146 | if title: 147 | search_params['titles'] = title 148 | 149 | raw_results = _wiki_request(search_params) 150 | 151 | if 'error' in raw_results: 152 | if raw_results['error']['info'] in ('HTTP request timed out.', 'Pool queue is full'): 153 | raise HTTPTimeoutError('{0}|{1}'.format(latitude, longitude)) 154 | else: 155 | raise WikipediaException(raw_results['error']['info']) 156 | 157 | search_pages = raw_results['query'].get('pages', None) 158 | if search_pages: 159 | search_results = (v['title'] for k, v in search_pages.items() if k != '-1') 160 | else: 161 | search_results = (d['title'] for d in raw_results['query']['geosearch']) 162 | 163 | return list(search_results) 164 | 165 | 166 | @cache 167 | def suggest(query): 168 | ''' 169 | Get a Wikipedia search suggestion for `query`. 170 | Returns a string or None if no suggestion was found. 171 | ''' 172 | 173 | search_params = { 174 | 'list': 'search', 175 | 'srinfo': 'suggestion', 176 | 'srprop': '', 177 | } 178 | search_params['srsearch'] = query 179 | 180 | raw_result = _wiki_request(search_params) 181 | 182 | if raw_result['query'].get('searchinfo'): 183 | return raw_result['query']['searchinfo']['suggestion'] 184 | 185 | return None 186 | 187 | 188 | def random(pages=1): 189 | ''' 190 | Get a list of random Wikipedia article titles. 191 | 192 | .. note:: Random only gets articles from namespace 0, meaning no Category, User talk, or other meta-Wikipedia pages. 193 | 194 | Keyword arguments: 195 | 196 | * pages - the number of random pages returned (max of 10) 197 | ''' 198 | #http://en.wikipedia.org/w/api.php?action=query&list=random&rnlimit=5000&format=jsonfm 199 | query_params = { 200 | 'list': 'random', 201 | 'rnnamespace': 0, 202 | 'rnlimit': pages, 203 | } 204 | 205 | request = _wiki_request(query_params) 206 | titles = [page['title'] for page in request['query']['random']] 207 | 208 | if len(titles) == 1: 209 | return titles[0] 210 | 211 | return titles 212 | 213 | 214 | @cache 215 | def summary(title, sentences=0, chars=0, auto_suggest=True, redirect=True): 216 | ''' 217 | Plain text summary of the page. 218 | 219 | .. note:: This is a convenience wrapper - auto_suggest and redirect are enabled by default 220 | 221 | Keyword arguments: 222 | 223 | * sentences - if set, return the first `sentences` sentences (can be no greater than 10). 224 | * chars - if set, return only the first `chars` characters (actual text returned may be slightly longer). 225 | * auto_suggest - let Wikipedia find a valid page title for the query 226 | * redirect - allow redirection without raising RedirectError 227 | ''' 228 | 229 | # use auto_suggest and redirect to get the correct article 230 | # also, use page's error checking to raise DisambiguationError if necessary 231 | page_info = page(title, auto_suggest=auto_suggest, redirect=redirect) 232 | title = page_info.title 233 | pageid = page_info.pageid 234 | 235 | query_params = { 236 | 'prop': 'extracts', 237 | 'explaintext': '', 238 | 'titles': title 239 | } 240 | 241 | if sentences: 242 | query_params['exsentences'] = sentences 243 | elif chars: 244 | query_params['exchars'] = chars 245 | else: 246 | query_params['exintro'] = '' 247 | 248 | request = _wiki_request(query_params) 249 | summary = request['query']['pages'][pageid]['extract'] 250 | 251 | return summary 252 | 253 | 254 | def page(title=None, pageid=None, auto_suggest=True, redirect=True, preload=False): 255 | ''' 256 | Get a WikipediaPage object for the page with title `title` or the pageid 257 | `pageid` (mutually exclusive). 258 | 259 | Keyword arguments: 260 | 261 | * title - the title of the page to load 262 | * pageid - the numeric pageid of the page to load 263 | * auto_suggest - let Wikipedia find a valid page title for the query 264 | * redirect - allow redirection without raising RedirectError 265 | * preload - load content, summary, images, references, and links during initialization 266 | ''' 267 | 268 | if title is not None: 269 | if auto_suggest: 270 | results, suggestion = search(title, results=1, suggestion=True) 271 | try: 272 | title = suggestion or results[0] 273 | except IndexError: 274 | # if there is no suggestion or search results, the page doesn't exist 275 | raise PageError(title) 276 | return WikipediaPage(title, redirect=redirect, preload=preload) 277 | elif pageid is not None: 278 | return WikipediaPage(pageid=pageid, preload=preload) 279 | else: 280 | raise ValueError("Either a title or a pageid must be specified") 281 | 282 | 283 | 284 | class WikipediaPage(object): 285 | ''' 286 | Contains data from a Wikipedia page. 287 | Uses property methods to filter data from the raw HTML. 288 | ''' 289 | 290 | def __init__(self, title=None, pageid=None, redirect=True, preload=False, original_title=''): 291 | if title is not None: 292 | self.title = title 293 | self.original_title = original_title or title 294 | elif pageid is not None: 295 | self.pageid = pageid 296 | else: 297 | raise ValueError("Either a title or a pageid must be specified") 298 | 299 | self.__load(redirect=redirect, preload=preload) 300 | 301 | if preload: 302 | for prop in ('content', 'summary', 'images', 'references', 'links', 'sections'): 303 | getattr(self, prop) 304 | 305 | def __repr__(self): 306 | return stdout_encode(u''.format(self.title)) 307 | 308 | def __eq__(self, other): 309 | try: 310 | return ( 311 | self.pageid == other.pageid 312 | and self.title == other.title 313 | and self.url == other.url 314 | ) 315 | except: 316 | return False 317 | 318 | def __load(self, redirect=True, preload=False): 319 | ''' 320 | Load basic information from Wikipedia. 321 | Confirm that page exists and is not a disambiguation/redirect. 322 | 323 | Does not need to be called manually, should be called automatically during __init__. 324 | ''' 325 | query_params = { 326 | 'prop': 'info|pageprops', 327 | 'inprop': 'url', 328 | 'ppprop': 'disambiguation', 329 | 'redirects': '', 330 | } 331 | if not getattr(self, 'pageid', None): 332 | query_params['titles'] = self.title 333 | else: 334 | query_params['pageids'] = self.pageid 335 | 336 | request = _wiki_request(query_params) 337 | 338 | query = request['query'] 339 | pageid = list(query['pages'].keys())[0] 340 | page = query['pages'][pageid] 341 | 342 | # missing is present if the page is missing 343 | if 'missing' in page: 344 | if hasattr(self, 'title'): 345 | raise PageError(self.title) 346 | else: 347 | raise PageError(pageid=self.pageid) 348 | 349 | # same thing for redirect, except it shows up in query instead of page for 350 | # whatever silly reason 351 | # Skip if on the other end of a redirect. 352 | elif 'redirects' in query and page['title'] != query['redirects'][0]['to']: 353 | if redirect: 354 | redirects = query['redirects'][0] 355 | 356 | if 'normalized' in query: 357 | normalized = query['normalized'][0] 358 | assert normalized['from'] == self.title, ODD_ERROR_MESSAGE 359 | 360 | from_title = normalized['to'] 361 | 362 | elif hasattr(self, 'title'): 363 | from_title = self.title 364 | 365 | else: 366 | from_title = redirects['from'] 367 | 368 | assert redirects['from'] == from_title, ODD_ERROR_MESSAGE 369 | 370 | # change the title and reload the whole object 371 | self.__init__(redirects['to'], redirect=redirect, preload=preload) 372 | 373 | else: 374 | raise RedirectError(getattr(self, 'title', page['title'])) 375 | 376 | # since we only asked for disambiguation in ppprop, 377 | # if a pageprop is returned, 378 | # then the page must be a disambiguation page 379 | elif 'pageprops' in page: 380 | query_params = { 381 | 'prop': 'revisions', 382 | 'rvprop': 'content', 383 | 'rvparse': '', 384 | 'rvlimit': 1 385 | } 386 | if hasattr(self, 'pageid'): 387 | query_params['pageids'] = self.pageid 388 | else: 389 | query_params['titles'] = self.title 390 | request = _wiki_request(query_params) 391 | html = request['query']['pages'][pageid]['revisions'][0]['*'] 392 | 393 | lis = BeautifulSoup(html, 'html.parser').find_all('li') 394 | filtered_lis = [li for li in lis if not 'tocsection' in ''.join(li.get('class', []))] 395 | may_refer_to = [li.a.get_text() for li in filtered_lis if li.a] 396 | 397 | raise DisambiguationError(getattr(self, 'title', page['title']), may_refer_to) 398 | 399 | else: 400 | self.pageid = pageid 401 | self.title = page['title'] 402 | self.url = page['fullurl'] 403 | 404 | def __continued_query(self, query_params): 405 | ''' 406 | Based on https://www.mediawiki.org/wiki/API:Query#Continuing_queries 407 | ''' 408 | query_params.update(self.__title_query_param) 409 | 410 | last_continue = {} 411 | prop = query_params.get('prop', None) 412 | 413 | while True: 414 | params = query_params.copy() 415 | params.update(last_continue) 416 | 417 | request = _wiki_request(params) 418 | 419 | if 'query' not in request: 420 | break 421 | 422 | pages = request['query']['pages'] 423 | if 'generator' in query_params: 424 | for datum in pages.values(): # in python 3.3+: "yield from pages.values()" 425 | yield datum 426 | else: 427 | for datum in pages[self.pageid][prop]: 428 | yield datum 429 | 430 | if 'continue' not in request: 431 | break 432 | 433 | last_continue = request['continue'] 434 | 435 | @property 436 | def __title_query_param(self): 437 | if getattr(self, 'title', None) is not None: 438 | return {'titles': self.title} 439 | else: 440 | return {'pageids': self.pageid} 441 | 442 | def html(self): 443 | ''' 444 | Get full page HTML. 445 | 446 | .. warning:: This can get pretty slow on long pages. 447 | ''' 448 | 449 | if not getattr(self, '_html', False): 450 | query_params = { 451 | 'prop': 'revisions', 452 | 'rvprop': 'content', 453 | 'rvlimit': 1, 454 | 'rvparse': '', 455 | 'titles': self.title 456 | } 457 | 458 | request = _wiki_request(query_params) 459 | self._html = request['query']['pages'][self.pageid]['revisions'][0]['*'] 460 | 461 | return self._html 462 | 463 | @property 464 | def content(self): 465 | ''' 466 | Plain text content of the page, excluding images, tables, and other data. 467 | ''' 468 | 469 | if not getattr(self, '_content', False): 470 | query_params = { 471 | 'prop': 'extracts|revisions', 472 | 'explaintext': '', 473 | 'rvprop': 'ids' 474 | } 475 | if not getattr(self, 'title', None) is None: 476 | query_params['titles'] = self.title 477 | else: 478 | query_params['pageids'] = self.pageid 479 | request = _wiki_request(query_params) 480 | self._content = request['query']['pages'][self.pageid]['extract'] 481 | self._revision_id = request['query']['pages'][self.pageid]['revisions'][0]['revid'] 482 | self._parent_id = request['query']['pages'][self.pageid]['revisions'][0]['parentid'] 483 | 484 | return self._content 485 | 486 | @property 487 | def revision_id(self): 488 | ''' 489 | Revision ID of the page. 490 | 491 | The revision ID is a number that uniquely identifies the current 492 | version of the page. It can be used to create the permalink or for 493 | other direct API calls. See `Help:Page history 494 | `_ for more 495 | information. 496 | ''' 497 | 498 | if not getattr(self, '_revid', False): 499 | # fetch the content (side effect is loading the revid) 500 | self.content 501 | 502 | return self._revision_id 503 | 504 | @property 505 | def parent_id(self): 506 | ''' 507 | Revision ID of the parent version of the current revision of this 508 | page. See ``revision_id`` for more information. 509 | ''' 510 | 511 | if not getattr(self, '_parentid', False): 512 | # fetch the content (side effect is loading the revid) 513 | self.content 514 | 515 | return self._parent_id 516 | 517 | @property 518 | def summary(self): 519 | ''' 520 | Plain text summary of the page. 521 | ''' 522 | 523 | if not getattr(self, '_summary', False): 524 | query_params = { 525 | 'prop': 'extracts', 526 | 'explaintext': '', 527 | 'exintro': '', 528 | } 529 | if not getattr(self, 'title', None) is None: 530 | query_params['titles'] = self.title 531 | else: 532 | query_params['pageids'] = self.pageid 533 | 534 | request = _wiki_request(query_params) 535 | self._summary = request['query']['pages'][self.pageid]['extract'] 536 | 537 | return self._summary 538 | 539 | @property 540 | def images(self): 541 | ''' 542 | List of URLs of images on the page. 543 | ''' 544 | 545 | if not getattr(self, '_images', False): 546 | self._images = [ 547 | page['imageinfo'][0]['url'] 548 | for page in self.__continued_query({ 549 | 'generator': 'images', 550 | 'gimlimit': 'max', 551 | 'prop': 'imageinfo', 552 | 'iiprop': 'url', 553 | }) 554 | if 'imageinfo' in page 555 | ] 556 | 557 | return self._images 558 | 559 | @property 560 | def coordinates(self): 561 | ''' 562 | Tuple of Decimals in the form of (lat, lon) or None 563 | ''' 564 | if not getattr(self, '_coordinates', False): 565 | query_params = { 566 | 'prop': 'coordinates', 567 | 'colimit': 'max', 568 | 'titles': self.title, 569 | } 570 | 571 | request = _wiki_request(query_params) 572 | 573 | if 'query' in request: 574 | coordinates = request['query']['pages'][self.pageid]['coordinates'] 575 | self._coordinates = (Decimal(coordinates[0]['lat']), Decimal(coordinates[0]['lon'])) 576 | else: 577 | self._coordinates = None 578 | 579 | return self._coordinates 580 | 581 | @property 582 | def references(self): 583 | ''' 584 | List of URLs of external links on a page. 585 | May include external links within page that aren't technically cited anywhere. 586 | ''' 587 | 588 | if not getattr(self, '_references', False): 589 | def add_protocol(url): 590 | return url if url.startswith('http') else 'http:' + url 591 | 592 | self._references = [ 593 | add_protocol(link['*']) 594 | for link in self.__continued_query({ 595 | 'prop': 'extlinks', 596 | 'ellimit': 'max' 597 | }) 598 | ] 599 | 600 | return self._references 601 | 602 | @property 603 | def links(self): 604 | ''' 605 | List of titles of Wikipedia page links on a page. 606 | 607 | .. note:: Only includes articles from namespace 0, meaning no Category, User talk, or other meta-Wikipedia pages. 608 | ''' 609 | 610 | if not getattr(self, '_links', False): 611 | self._links = [ 612 | link['title'] 613 | for link in self.__continued_query({ 614 | 'prop': 'links', 615 | 'plnamespace': 0, 616 | 'pllimit': 'max' 617 | }) 618 | ] 619 | 620 | return self._links 621 | 622 | @property 623 | def categories(self): 624 | ''' 625 | List of categories of a page. 626 | ''' 627 | 628 | if not getattr(self, '_categories', False): 629 | self._categories = [re.sub(r'^Category:', '', x) for x in 630 | [link['title'] 631 | for link in self.__continued_query({ 632 | 'prop': 'categories', 633 | 'cllimit': 'max' 634 | }) 635 | ]] 636 | 637 | return self._categories 638 | 639 | @property 640 | def sections(self): 641 | ''' 642 | List of section titles from the table of contents on the page. 643 | ''' 644 | 645 | if not getattr(self, '_sections', False): 646 | query_params = { 647 | 'action': 'parse', 648 | 'prop': 'sections', 649 | } 650 | query_params.update(self.__title_query_param) 651 | 652 | request = _wiki_request(query_params) 653 | self._sections = [section['line'] for section in request['parse']['sections']] 654 | 655 | return self._sections 656 | 657 | def section(self, section_title): 658 | ''' 659 | Get the plain text content of a section from `self.sections`. 660 | Returns None if `section_title` isn't found, otherwise returns a whitespace stripped string. 661 | 662 | This is a convenience method that wraps self.content. 663 | 664 | .. warning:: Calling `section` on a section that has subheadings will NOT return 665 | the full text of all of the subsections. It only gets the text between 666 | `section_title` and the next subheading, which is often empty. 667 | ''' 668 | 669 | section = u"== {} ==".format(section_title) 670 | try: 671 | index = self.content.index(section) + len(section) 672 | except ValueError: 673 | return None 674 | 675 | try: 676 | next_index = self.content.index("==", index) 677 | except ValueError: 678 | next_index = len(self.content) 679 | 680 | return self.content[index:next_index].lstrip("=").strip() 681 | 682 | 683 | @cache 684 | def languages(): 685 | ''' 686 | List all the currently supported language prefixes (usually ISO language code). 687 | 688 | Can be inputted to `set_lang` to change the Mediawiki that `wikipedia` requests 689 | results from. 690 | 691 | Returns: dict of : pairs. To get just a list of prefixes, 692 | use `wikipedia.languages().keys()`. 693 | ''' 694 | response = _wiki_request({ 695 | 'meta': 'siteinfo', 696 | 'siprop': 'languages' 697 | }) 698 | 699 | languages = response['query']['languages'] 700 | 701 | return { 702 | lang['code']: lang['*'] 703 | for lang in languages 704 | } 705 | 706 | 707 | def donate(): 708 | ''' 709 | Open up the Wikimedia donate page in your favorite browser. 710 | ''' 711 | import webbrowser 712 | 713 | webbrowser.open('https://donate.wikimedia.org/w/index.php?title=Special:FundraiserLandingPage', new=2) 714 | 715 | 716 | def _wiki_request(params): 717 | ''' 718 | Make a request to the Wikipedia API using the given search parameters. 719 | Returns a parsed dict of the JSON response. 720 | ''' 721 | global RATE_LIMIT_LAST_CALL 722 | global USER_AGENT 723 | 724 | params['format'] = 'json' 725 | if not 'action' in params: 726 | params['action'] = 'query' 727 | 728 | headers = { 729 | 'User-Agent': USER_AGENT 730 | } 731 | 732 | if RATE_LIMIT and RATE_LIMIT_LAST_CALL and \ 733 | RATE_LIMIT_LAST_CALL + RATE_LIMIT_MIN_WAIT > datetime.now(): 734 | 735 | # it hasn't been long enough since the last API call 736 | # so wait until we're in the clear to make the request 737 | 738 | wait_time = (RATE_LIMIT_LAST_CALL + RATE_LIMIT_MIN_WAIT) - datetime.now() 739 | time.sleep(int(wait_time.total_seconds())) 740 | 741 | r = requests.get(API_URL, params=params, headers=headers) 742 | 743 | if RATE_LIMIT: 744 | RATE_LIMIT_LAST_CALL = datetime.now() 745 | 746 | return r.json() 747 | -------------------------------------------------------------------------------- /tests/request_mock_data.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | from __future__ import unicode_literals 3 | 4 | mock_data = { 5 | "_wiki_request calls": { 6 | 7 | (('explaintext', ''), ('prop', 'extracts|revisions'), ('rvprop', 'ids'), ('titles', 'Celtuce')): 8 | {'query': {'pages': {'1868108': {'extract': 'Celtuce (Lactuca sativa var. asparagina, augustana, or angustata), also called stem lettuce, celery lettuce, asparagus lettuce, or Chinese lettuce, IPA (UK,US) /\u02c8s\u025blt.\u0259s/, is a cultivar of lettuce grown primarily for its thick stem, used as a vegetable. It is especially popular in China, and is called wosun (Chinese: \u83b4\u7b0b; pinyin: w\u014ds\u016dn) or woju (Chinese: \u83b4\u82e3; pinyin: w\u014dj\xf9) (although the latter name may also be used to mean lettuce in general).\n\nThe stem is usually harvested at a length of around 15\u201320 cm and a diameter of around 3\u20134 cm. It is crisp, moist, and mildly flavored, and typically prepared by slicing and then stir frying with more strongly flavored ingredients.\n\nDown: Photos of the celtuce, chinese lettuce or "Wosun" taken in the province of Girona (Catalonia, Spain, Europe) in June 2013\nCeltuce Nutritional content', 'ns': 0, 'pageid': 1868108, 'revisions': [{'revid': 575687826, 'parentid': 574302108}], 'title': 'Celtuce'}}}}, 9 | 10 | (('explaintext', ''), ('prop', 'extracts|revisions'), ('rvprop', 'ids'), ('titles', 'Tropical Depression Ten (2005)')): 11 | {'query': {'pages': {'21196082': {'extract': 'Tropical Depression Ten was the tenth tropical cyclone of the record-breaking 2005 Atlantic hurricane season. It formed on August 13 from a tropical wave that emerged from the west coast of Africa on August 8. As a result of strong wind shear, the depression remained weak and did not strengthen beyond tropical depression status. The cyclone degenerated on August 14, although its remnants partially contributed to the formation of Tropical Depression Twelve, which eventually intensified into Hurricane Katrina. The cyclone had no effect on land, and did not directly result in any fatalities or damage.\n\n\n== Meteorological history ==\n\nOn August 8, a tropical wave emerged from the west coast of Africa and entered the Atlantic Ocean. Tracking towards the west, the depression began to exhibit signs of convective organization on August 11. The system continued to develop, and it is estimated that Tropical Depression Ten formed at 1200 UTC on August 13. At the time, it was located about 1,600 miles (2,600 km) east of Barbados. Upon its designation, the depression consisted of a large area of thunderstorm activity, with curved banding features and expanding outflow. However, the environmental conditions were predicted to quickly become unfavorable. The depression moved erratically and slowly towards the west, and wind shear inhibited any significant intensification. Late on August 13, it was "beginning to look like Irene-junior as it undergoes southwesterly mid-level shear beneath the otherwise favorable upper-level outflow pattern". The wind shear was expected to relent within 48 hours, prompting some forecast models to suggest the depression would eventually attain hurricane status.\nBy early August 14, the shear had substantially disrupted the storm, leaving the low-level center of circulation exposed from the area of convection, which was also deteriorating. After meandering, the storm began to move westward. Forecasters expected it to resume a northwestward track as high pressure to the south of Bermuda was forecasted to weaken and another high was predicted to form southwest of the Azores. By 1800 UTC on August 14, the strong shear had further weakened the storm, and it no longer met the criteria for a tropical cyclone. It degenerated into a remnant low, and the National Hurricane Center issued their final advisory on the cyclone. Moving westward, it occasionally produced bursts of convective activity, before dissipating on August 18.\nTropical Depression Twelve formed over the southeastern Bahamas at 2100 UTC on August 23, partially from the remains of Tropical Depression Ten. While the normal standards for numbering tropical depressions in the Atlantic stipulate that the initial designation be retained when a depression regenerates, satellite imagery indicated that a second tropical wave had combined with Tropical Depression Ten north of Puerto Rico to form a new, more complex weather system, which was then designated as Tropical Depression Twelve. In a re-analysis, it was found that the low-level circulation of Tropical Depression Ten had completely detached and dissipated; only the remnant mid-level circulation moved on and merged with the second tropical wave. As a result, the criteria for keeping the same name and identity were not met. Tropical Depression Twelve later became Hurricane Katrina.\n\n\n== Impact ==\nBecause Tropical Depression Ten never approached land as a tropical cyclone, no tropical cyclone watches and warnings were issued for any land masses. No effects, damages, or fatalities were reported, and no ships reported tropical storm-force winds in association with the depression. The system did not attain tropical storm status; as such, it was not given a name by the National Hurricane Center. The storm partially contributed to the formation of Hurricane Katrina, which became a Category 5 hurricane on the Saffir-Simpson Hurricane Scale and made landfall in Louisiana, causing catastrophic damage. Katrina was the costliest hurricane, and one of the five deadliest, in the history of the United States.\n\n\n== See also ==\n\nMeteorological history of Hurricane Katrina\nList of storms in the 2005 Atlantic hurricane season\nTimeline of the 2005 Atlantic hurricane season\n\n\n== References ==\n\n\n== External links ==\n\nTropical Depression Ten Tropical Cyclone Report\nTropical Depression Ten advisory archive', 'ns': 0, 'pageid': 21196082, 'revisions': [{'revid': 572715399, 'parentid': 539367750}], 'title': 'Tropical Depression Ten (2005)'}}}}, 12 | 13 | (('inprop', 'url'), ('ppprop', 'disambiguation'), ('prop', 'info|pageprops'), ('redirects', ''), ('titles', 'purpleberry')): 14 | {'query': {'normalized': [{'to': 'Purpleberry', 'from': 'purpleberry'}], 'pages': {'-1': {'missing': '', 'editurl': 'http://en.wikipedia.org/w/index.php?title=Purpleberry&action=edit', 'title': 'Purpleberry', 'contentmodel': 'wikitext', 'pagelanguage': 'en', 'ns': 0, 'fullurl': 'http://en.wikipedia.org/wiki/Purpleberry'}}}}, 15 | 16 | (('limit', 1), ('list', 'search'), ('srinfo', 'suggestion'), ('srlimit', 1), ('srprop', ''), ('srsearch', 'Menlo Park, New Jersey')): 17 | {'query-continue': {'search': {'sroffset': 1}}, 'query': {'search': [{'ns': 0, 'title': 'Edison, New Jersey'}]}, 'warnings': {'main': {'*': "Unrecognized parameter: 'limit'"}}}, 18 | 19 | (('inprop', 'url'), ('ppprop', 'disambiguation'), ('prop', 'info|pageprops'), ('redirects', ''), ('titles', 'Menlo Park, New Jersey')): 20 | {'query': {'redirects': [{'to': 'Edison, New Jersey', 'from': 'Menlo Park, New Jersey'}], 'pages': {'125414': {'lastrevid': 607768264, 'pageid': 125414, 'title': 'Edison, New Jersey', 'editurl': 'http://en.wikipedia.org/w/index.php?title=Edison,_New_Jersey&action=edit', 'counter': '', 'length': 85175, 'contentmodel': 'wikitext', 'pagelanguage': 'en', 'touched': '2014-05-14T17:10:49Z', 'ns': 0, 'fullurl': 'http://en.wikipedia.org/wiki/Edison,_New_Jersey'}}}}, 21 | 22 | (('inprop', 'url'), ('ppprop', 'disambiguation'), ('prop', 'info|pageprops'), ('redirects', ''), ('titles', 'Communist Party')): 23 | {'query': {'redirects': [{'to': 'Communist party', 'from': 'Communist Party'}], 'pages': {'37008': {'lastrevid': 608086859, 'pageid': 37008, 'title': 'Communist party', 'editurl': 'http://en.wikipedia.org/w/index.php?title=Communist_party&action=edit', 'counter': '', 'length': 7868, 'contentmodel': 'wikitext', 'pagelanguage': 'en', 'touched': '2014-05-26T01:19:01Z', 'ns': 0, 'fullurl': 'http://en.wikipedia.org/wiki/Communist_party'}}}}, 24 | 25 | (('inprop', 'url'), ('ppprop', 'disambiguation'), ('prop', 'info|pageprops'), ('redirects', ''), ('titles', 'communist Party')): 26 | {'query': {'redirects': [{'to': 'Communist party', 'from': 'Communist Party'}], 'normalized': [{'to': 'Communist Party', 'from': 'communist Party'}], 'pages': {'37008': {'lastrevid': 608086859, 'pageid': 37008, 'title': 'Communist party', 'editurl': 'http://en.wikipedia.org/w/index.php?title=Communist_party&action=edit', 'counter': '', 'length': 7868, 'contentmodel': 'wikitext', 'pagelanguage': 'en', 'touched': '2014-05-26T01:19:01Z', 'ns': 0, 'fullurl': 'http://en.wikipedia.org/wiki/Communist_party'}}}}, 27 | 28 | (('inprop', 'url'), ('ppprop', 'disambiguation'), ('prop', 'info|pageprops'), ('redirects', ''), ('titles', 'Communist party')): 29 | {'query': {'pages': {'37008': {'lastrevid': 608086859, 'pageid': 37008, 'title': 'Communist party', 'editurl': 'http://en.wikipedia.org/w/index.php?title=Communist_party&action=edit', 'counter': '', 'length': 7868, 'contentmodel': 'wikitext', 'pagelanguage': 'en', 'touched': '2014-05-26T01:19:01Z', 'ns': 0, 'fullurl': 'http://en.wikipedia.org/wiki/Communist_party'}}}}, 30 | 31 | (('inprop', 'url'), ('ppprop', 'disambiguation'), ('prop', 'info|pageprops'), ('redirects', ''), ('titles', 'Edison, New Jersey')): 32 | {'query': {'pages': {'125414': {'lastrevid': 607768264, 'pageid': 125414, 'title': 'Edison, New Jersey', 'editurl': 'http://en.wikipedia.org/w/index.php?title=Edison,_New_Jersey&action=edit', 'counter': '', 'length': 85175, 'contentmodel': 'wikitext', 'pagelanguage': 'en', 'touched': '2014-05-14T17:10:49Z', 'ns': 0, 'fullurl': 'http://en.wikipedia.org/wiki/Edison,_New_Jersey'}}}}, 33 | 34 | (('inprop', 'url'), ('ppprop', 'disambiguation'), ('prop', 'info|pageprops'), ('redirects', ''), ('titles', 'Dodge Ram (disambiguation)')): 35 | {'query': {'pages': {'18803364': {'lastrevid': 567152802, 'pageid': 18803364, 'title': 'Dodge Ram (disambiguation)', 'editurl': 'http://en.wikipedia.org/w/index.php?title=Dodge_Ram_(disambiguation)&action=edit', 'counter': '', 'length': 702, 'contentmodel': 'wikitext', 'pagelanguage': 'en', 'touched': '2013-08-08T15:12:27Z', 'ns': 0, 'pageprops': {'disambiguation': ''}, 'fullurl': 'http://en.wikipedia.org/wiki/Dodge_Ram_(disambiguation)'}}}}, 36 | 37 | (('prop', 'revisions'), ('rvlimit', 1), ('rvparse', ''), ('rvprop', 'content'), ('titles', 'Dodge Ram (disambiguation)')): 38 | {'query-continue': {'revisions': {'rvcontinue': 556603298}}, 'query': {'pages': {'18803364': {'ns': 0, 'pageid': 18803364, 'revisions': [{'*': '

Dodge Ram is a collective nameplate for light trucks made by Dodge\n

\n\n

See also:\n

\n\n\n\n\n\n\n\n'}], 'title': 'Dodge Ram (disambiguation)'}}}}, 39 | 40 | (('limit', 1), ('list', 'search'), ('srinfo', 'suggestion'), ('srlimit', 1), ('srprop', ''), ('srsearch', 'butteryfly')): 41 | {'query-continue': {'search': {'sroffset': 1}}, 'query': {'searchinfo': {'suggestion': 'butterfly'}, 'search': [{'ns': 0, 'title': "Butterfly's Tongue"}]}, 'warnings': {'main': {'*': "Unrecognized parameter: 'limit'"}}}, 42 | 43 | (('inprop', 'url'), ('ppprop', 'disambiguation'), ('prop', 'info|pageprops'), ('redirects', ''), ('titles', 'butterfly')): 44 | {'query': {'normalized': [{'to': 'Butterfly', 'from': 'butterfly'}], 'pages': {'48338': {'lastrevid': 566847704, 'pageid': 48338, 'title': 'Butterfly', 'editurl': 'http://en.wikipedia.org/w/index.php?title=Butterfly&action=edit', 'counter': '', 'length': 60572, 'contentmodel': 'wikitext', ' pagelanguage': 'en', 'touched': '2013-08-07T11:15:37Z', 'ns': 0, 'fullurl': 'http://en.wikipedia.org/wiki/Butterfly'}}}}, 45 | 46 | (('limit', 1), ('list', 'search'), ('srinfo', 'suggestion'), ('srlimit', 1), ('srprop', ''), ('srsearch', 'Celtuce')): 47 | {'query-continue': {'search': {'sroffset': 1}}, 'query': {'search': [{'ns': 0, 'title': 'Celtuce'}]}, 'warnings': {'main': {'*': "Unrecognized parameter: 'limit'"}}}, 48 | 49 | (('limit', 1), ('list', 'search'), ('srinfo', 'suggestion'), ('srlimit', 1), ('srprop', ''), ('srsearch', 'Tropical Depression Ten (2005)')): 50 | {'query-continue': {'search': {'sroffset': 1}}, 'query': {'search': [{'ns': 0, 'title': 'Tropical Depression Ten (2005)'}]}, 'warnings': {'main': {'*': "Unrecognized parameter: 'limit'"}}}, 51 | 52 | (('limit', 1), ('list', 'search'), ('srinfo', 'suggestion'), ('srlimit', 1), ('srprop', ''), ('srsearch', 'Great Wall of China')): 53 | {'query-continue': {'search': {'sroffset': 1}}, 'query': {'search': [{'ns': 0, 'title': 'Great Wall of China'}]}, 'warnings': {'main': {'*': "Unrecognized parameter: 'limit'"}}}, 54 | 55 | (('inprop', 'url'), ('ppprop', 'disambiguation'), ('prop', 'info|pageprops'), ('redirects', ''), ('titles', 'Celtuce')): 56 | {'query': {'pages': {'1868108': {'lastrevid': 562756085, 'pageid': 1868108, 'title': 'Celtuce', 'editurl': 'http://en.wikipedia.org/w/index.php?title=Celtuce&action=edit', 'counter': '', 'length': 1662, 'contentmodel': 'wikitext', 'pagelanguage': 'en', 'touched': '2013-08-17T03:30:23Z', 'ns': 0, 'fullurl': 'http://en.wikipedia.org/wiki/Celtuce'}}}}, 57 | 58 | (('inprop', 'url'), ('ppprop', 'disambiguation'), ('prop', 'info|pageprops'), ('redirects', ''), ('titles', 'Tropical Depression Ten (2005)')): 59 | {'query': {'pages': {'21196082': {'lastrevid': 572715399, 'pageid': 21196082, 'title': 'Tropical Depression Ten (2005)', 'editurl': 'http://en.wikipedia.org/w/index.php?title=Tropical_Depression_Ten_(2005)&action=edit', 'counter': '', 'length': 8543, 'contentmodel': 'wikitext', 'pagelanguage': 'en', 'touched': '2013-09-18T13:45:33Z', 'ns': 0, 'fullurl': 'http://en.wikipedia.org/wiki/Tropical_Depression_Ten_(2005)'}}}}, 60 | 61 | (('inprop', 'url'), ('ppprop', 'disambiguation'), ('prop', 'info|pageprops'), ('redirects', ''), ('titles', 'Great Wall of China')): 62 | {'query': {'pages': {'5094570': {'lastrevid': 604138653, 'pageid': 5094570, 'title': 'Great Wall of China', 'editurl': 'http://en.wikipedia.org/w/index.php?title=Great_Wall_of_China&action=edit', 'counter': '', 'length': 23895, 'contentmodel': 'wikitext', 'pagelanguage': 'en', 'touched': '2013-08-17T03:30:23Z', 'ns': 0, 'fullurl': 'http://en.wikipedia.org/wiki/Great_Wall_of_China'}}}}, 63 | 64 | (('explaintext', ''), ('prop', 'extracts'), ('titles', 'Celtuce')): 65 | {'query': {'pages': {'1868108': {'extract': 'Celtuce (Lactuca sativa var. asparagina, augustana, or angustata), also called stem lettuce, celery lettuce, asparagus lettuce, or Chinese lettuce, IPA (UK,US) /\u02c8s\u025blt.\u0259s/, is a cultivar of lettuce grown primarily for its thick stem, used as a vegetable. It is especially popular in China, and is called wosun (Chinese: \u83b4\u7b0b; pinyin: w\u014ds\u016dn) or woju (Chinese: \u83b4\u82e3; pinyin: w\u014dj\xf9) (although the latter name may also be used to mean lettuce in general).\n\nThe stem is usually harvested at a length of around 15\u201320 cm and a diameter of around 3\u20134 cm. It is crisp, moist, and mildly flavored, and typically prepared by slicing and then stir frying with more strongly flavored ingredients.', 'ns': 0, 'pageid': 1868108, 'title': 'Celtuce'}}}}, 66 | 67 | (('exintro', ''), ('explaintext', ''), ('prop', 'extracts'), ('titles', 'Celtuce')): 68 | {'query': {'pages': {'1868108': {'extract': 'Celtuce (Lactuca sativa var. asparagina, augustana, or angustata), also called stem lettuce, celery lettuce, asparagus lettuce, or Chinese lettuce, IPA (UK,US) /\u02c8s\u025blt.\u0259s/, is a cultivar of lettuce grown primarily for its thick stem, used as a vegetable. It is especially popular in China, and is called wosun (Chinese: \u83b4\u7b0b; pinyin: w\u014ds\u016dn) or woju (Chinese: \u83b4\u82e3; pinyin: w\u014dj\xf9) (although the latter name may also be used to mean lettuce in general).\n\nThe stem is usually harvested at a length of around 15\u201320 cm and a diameter of around 3\u20134 cm. It is crisp, moist, and mildly flavored, and typically prepared by slicing and then stir frying with more strongly flavored ingredients.', 'ns': 0, 'pageid': 1868108, 'title': 'Celtuce'}}}}, 69 | 70 | (('exintro', ''), ('explaintext', ''), ('prop', 'extracts'), ('titles', 'Tropical Depression Ten (2005)')): 71 | {'query': {'pages': {'21196082': {'extract': 'Tropical Depression Ten was the tenth tropical cyclone of the record-breaking 2005 Atlantic hurricane season. It formed on August 13 from a tropical wave that emerged from the west coast of Africa on August 8. As a result of strong wind shear, the depression remained weak and did not strengthen beyond tropical depression status. The cyclone degenerated on August 14, although its remnants partially contributed to the formation of Tropical Depression Twelve, which eventually intensified into Hurricane Katrina. The cyclone had no effect on land, and did not directly result in any fatalities or damage.\n\n', 'ns': 0, 'pageid': 21196082, 'title': 'Tropical Depression Ten (2005)'}}}}, 72 | 73 | (('generator', 'images'), ('gimlimit', 'max'), ('iiprop', 'url'), ('prop', 'imageinfo'), ('titles', 'Celtuce')): 74 | {'query': {'pages': {'22263385': {'imagerepository': 'local', 'ns': 6, 'pageid': 22263385, 'imageinfo': [{'url': 'http://upload.wikimedia.org/wikipedia/en/9/99/Question_book-new.svg', 'descriptionurl': 'http://en.wikipedia.org/wiki/File:Question_book-new.svg'}], 'title': 'File:Question book-new.svg'}, '-1': {'imagerepository': 'shared', 'ns': 6, 'imageinfo': [{'url': 'http://upload.wikimedia.org/wikipedia/commons/8/87/Celtuce.jpg', 'descriptionurl': 'http://commons.wikimedia.org/wiki/File:Celtuce.jpg'}], 'missing': '', 'title': 'File:Celtuce.jpg'}, '-3': {'imagerepository': 'shared', 'ns': 6, 'imageinfo': [{'url': 'http://upload.wikimedia.org/wikipedia/commons/7/79/VegCorn.jpg', 'descriptionurl': 'http://commons.wikimedia.org/wiki/File:VegCorn.jpg'}], 'missing': '', 'title': 'File:VegCorn.jpg'}, '-2': {'imagerepository': 'shared', 'ns': 6, 'imageinfo': [{'url': 'http://upload.wikimedia.org/wikipedia/commons/d/dc/The_farmer%27s_market_near_the_Potala_in_Lhasa.jpg', 'descriptionurl': 'http://commons.wikimedia.org/wiki/File:The_farmer%27s_market_near_the_Potala_in_Lhasa.jpg'}], 'missing': '', 'title': "File:The farmer's market near the Potala in Lhasa.jpg"}}}, 'limits': {'images': 500}}, 75 | 76 | (('generator', 'images'), ('gimlimit', 'max'), ('iiprop', 'url'), ('prop', 'imageinfo'), ('titles', 'Tropical Depression Ten (2005)')): 77 | {'query': {'pages': {'33285577': {'imagerepository': 'local', 'ns': 6, 'pageid': 33285577, 'imageinfo': [{'url': 'http://upload.wikimedia.org/wikipedia/en/4/4a/Commons-logo.svg', 'descriptionurl': 'http://en.wikipedia.org/wiki/File:Commons-logo.svg'}], 'title': 'File:Commons-logo.svg'}, '23473511': {'imagerepository': 'local', 'ns': 6, 'pageid': 23473511, 'imageinfo': [{'url': 'http://upload.wikimedia.org/wikipedia/en/4/48/Folder_Hexagonal_Icon.svg', 'descriptionurl': 'http://en.wikipedia.org/wiki/File:Folder_Hexagonal_Icon.svg'}], 'title': 'File:Folder Hexagonal Icon.svg'}, '33285464': {'imagerepository': 'local', 'ns': 6, 'pageid': 33285464, 'imageinfo': [{'url': 'http://upload.wikimedia.org/wikipedia/en/e/e7/Cscr-featured.svg', 'descriptionurl': 'http://en.wikipedia.org/wiki/File:Cscr-featured.svg'}], 'title': 'File:Cscr-featured.svg'}, '2526001': {'imagerepository': 'shared', 'ns': 6, 'pageid': 2526001, 'imageinfo': [{'url': 'http://upload.wikimedia.org/wikipedia/commons/8/89/Cyclone_Catarina_from_the_ISS_on_March_26_2004.JPG', 'descriptionurl': 'http://commons.wikimedia.org/wiki/File:Cyclone_Catarina_from_the_ISS_on_March_26_2004.JPG'}], 'title': 'File:Cyclone Catarina from the ISS on March 26 2004.JPG'}, '33285257': {'imagerepository': 'local', 'ns': 6, 'pageid': 33285257, 'imageinfo': [{'url': 'http://upload.wikimedia.org/wikipedia/en/f/fd/Portal-puzzle.svg', 'descriptionurl': 'http://en.wikipedia.org/wiki/File:Portal-puzzle.svg'}], 'title': 'File:Portal-puzzle.svg'}, '-5': {'imagerepository': 'shared', 'ns': 6, 'imageinfo': [{'url': 'http://upload.wikimedia.org/wikipedia/commons/8/89/Symbol_book_class2.svg', 'descriptionurl': 'http://commons.wikimedia.org/wiki/File:Symbol_book_class2.svg'}], 'missing': '', 'title': 'File:Symbol book class2.svg'}, '-4': {'imagerepository': 'shared', 'ns': 6, 'imageinfo': [{'url': 'http://upload.wikimedia.org/wikipedia/commons/4/47/Sound-icon.svg', 'descriptionurl': 'http://commons.wikimedia.org/wiki/File:Sound-icon.svg'}], 'missing': '', 'title': 'File:Sound-icon.svg'}, '-7': {'imagerepository': 'shared', 'ns': 6, 'imageinfo': [{'url': 'http://upload.wikimedia.org/wikipedia/commons/7/7d/Tropical_Depression_10_%282005%29.png', 'descriptionurl': 'http://commons.wikimedia.org/wiki/File:Tropical_Depression_10_(2005).png'}], 'missing': '', 'title': 'File:Tropical Depression 10 (2005).png'}, '-6': {'imagerepository': 'shared', 'ns': 6, 'imageinfo': [{'url': 'http://upload.wikimedia.org/wikipedia/commons/4/4a/TD_10_August_13%2C_2005.jpg', 'descriptionurl': 'http://commons.wikimedia.org/wiki/File:TD_10_August_13,_2005.jpg'}], 'missing': '', 'title': 'File:TD 10 August 13, 2005.jpg'}, '-1': {'imagerepository': 'shared', 'ns': 6, 'imageinfo': [{'url': 'http://upload.wikimedia.org/wikipedia/commons/a/a5/10-L_2005_track.png', 'descriptionurl': 'http://commons.wikimedia.org/wiki/File:10-L_2005_track.png'}], 'missing': '', 'title': 'File:10-L 2005 track.png'}, '-3': {'imagerepository': 'shared', 'ns': 6, 'imageinfo': [{'url': 'http://upload.wikimedia.org/wikipedia/commons/3/37/People_icon.svg', 'descriptionurl': 'http://commons.wikimedia.org/wiki/File:People_icon.svg'}], 'missing': '', 'title': 'File:People icon.svg'}, '-2': {'imagerepository': 'shared', 'ns': 6, 'imageinfo': [{'url': 'http://upload.wikimedia.org/wikipedia/commons/e/e0/2005_Atlantic_hurricane_season_summary_map.png', 'descriptionurl': 'http://commons.wikimedia.org/wiki/File:2005_Atlantic_hurricane_season_summary_map.png'}], 'missing': '', 'title': 'File:2005 Atlantic hurricane season summary map.png'}, '-8': {'imagerepository': 'shared', 'ns': 6, 'imageinfo': [{'url': 'http://upload.wikimedia.org/wikipedia/commons/3/33/Tropical_Depression_Ten_%282005%29.ogg', 'descriptionurl': 'http://commons.wikimedia.org/wiki/File:Tropical_Depression_Ten_(2005).ogg'}], 'missing': '', 'title': 'File:Tropical Depression Ten (2005).ogg'}}}, 'limits': {'images': 500}}, 78 | 79 | (('ellimit', 'max'), ('prop', 'extlinks'), ('titles', 'Celtuce')): 80 | {'query': {'pages': {'1868108': {'extlinks': [{'*': 'http://ndb.nal.usda.gov/ndb/search/list'}, {'*': 'http://ndb.nal.usda.gov/ndb/search/list?qlookup=11145&format=Full'}], 'ns': 0, 'pageid': 1868108, 'title': 'Celtuce'}}}, 'limits': {'extlinks': 500}}, 81 | 82 | (('ellimit', 'max'), ('prop', 'extlinks'), ('titles', 'Tropical Depression Ten (2005)')): 83 | {'query': {'pages': {'21196082': {'extlinks': [{'*': 'http://books.google.com/?id=-a8DRl1HuwoC&q=%22tropical+depression+ten%22+2005&dq=%22tropical+depression+ten%22+2005'}, {'*': 'http://facstaff.unca.edu/chennon/research/documents/erb_ncur2006_preprint.pdf'}, {'*': 'http://www.nhc.noaa.gov/archive/2005/TEN.shtml?'}, {'*': 'http://www.nhc.noaa.gov/archive/2005/dis/al102005.discus.001.shtml?'}, {'*': 'http://www.nhc.noaa.gov/archive/2005/dis/al102005.discus.002.shtml?'}, {'*': 'http://www.nhc.noaa.gov/archive/2005/dis/al102005.discus.003.shtml?'}, {'*': 'http://www.nhc.noaa.gov/archive/2005/dis/al122005.discus.001.shtml'}, {'*': 'http://www.nhc.noaa.gov/pdf/TCR-AL102005_Ten.pdf'}, {'*': 'http://www.nhc.noaa.gov/pdf/TCR-AL122005_Katrina.pdf'}, {'*': 'http://www.wptv.com/content/chopper5/story/Capt-Julie-Reports-On-Hurricane-Katrina/q__v8S2TZES2GiccRTQ2bw.cspx'}], 'ns': 0, 'pageid': 21196082, 'title': 'Tropical Depression Ten (2005)'}}}, 'limits': {'extlinks': 500}}, 84 | 85 | (('pllimit', 'max'), ('plnamespace', 0), ('prop', 'links'), ('titles', 'Celtuce')): 86 | {'query': {'pages': {'1868108': {'ns': 0, 'pageid': 1868108, 'links': [{'ns': 0, 'title': 'Calcium'}, {'ns': 0, 'title': 'Carbohydrate'}, {'ns': 0, 'title': 'Chinese language'}, {'ns': 0, 'title': 'Dietary Reference Intake'}, {'ns': 0, 'title': 'Dietary fiber'}, {'ns': 0, 'title': 'Fat'}, {'ns': 0, 'title': 'Folate'}, {'ns': 0, 'title': 'Food energy'}, {'ns': 0, 'title': 'Iron'}, {'ns': 0, 'title': 'Lettuce'}, {'ns': 0, 'title': 'Lhasa'}, {'ns': 0, 'title': 'Magnesium in biology'}, {'ns': 0, 'title': 'Manganese'}, {'ns': 0, 'title': 'Niacin'}, {'ns': 0, 'title': 'Pantothenic acid'}, {'ns': 0, 'title': 'Phosphorus'}, {'ns': 0, 'title': 'Pinyin'}, {'ns': 0, 'title': 'Plant stem'}, {'ns': 0, 'title': 'Potassium'}, {'ns': 0, 'title': 'Protein (nutrient)'}, {'ns': 0, 'title': 'Riboflavin'}, {'ns': 0, 'title': 'Sodium'}, {'ns': 0, 'title': 'Stir frying'}, {'ns': 0, 'title': 'Thiamine'}, {'ns': 0, 'title': 'Vegetable'}, {'ns': 0, 'title': 'Vitamin A'}, {'ns': 0, 'title': 'Vitamin B6'}, {'ns': 0, 'title': 'Vitamin C'}, {'ns': 0, 'title': 'Zinc'}], 'title': 'Celtuce'}}}, 'limits': {'links': 500}}, 87 | 88 | (('pllimit', 'max'), ('plnamespace', 0), ('prop', 'links'), ('titles', 'Tropical Depression Ten (2005)')): 89 | {'query': {'pages': {'21196082': {'ns': 0, 'pageid': 21196082, 'links': [{'ns': 0, 'title': '2005 Atlantic hurricane season'}, {'ns': 0, 'title': '2005 Azores subtropical storm'}, {'ns': 0, 'title': 'Atlantic Ocean'}, {'ns': 0, 'title': 'Atmospheric circulation'}, {'ns': 0, 'title': 'Atmospheric convection'}, {'ns': 0, 'title': 'Azores'}, {'ns': 0, 'title': 'Bahamas'}, {'ns': 0, 'title': 'Bar (unit)'}, {'ns': 0, 'title': 'Barbados'}, {'ns': 0, 'title': 'Bermuda'}, {'ns': 0, 'title': 'High pressure area'}, {'ns': 0, 'title': 'Hurricane Beta'}, {'ns': 0, 'title': 'Hurricane Cindy (2005)'}, {'ns': 0, 'title': 'Hurricane Dennis'}, {'ns': 0, 'title': 'Hurricane Emily (2005)'}, {'ns': 0, 'title': 'Hurricane Epsilon'}, {'ns': 0, 'title': 'Hurricane Irene (2005)'}, {'ns': 0, 'title': 'Hurricane Katrina'}, {'ns': 0, 'title': 'Hurricane Maria (2005)'}, {'ns': 0, 'title': 'Hurricane Nate (2005)'}, {'ns': 0, 'title': 'Hurricane Ophelia (2005)'}, {'ns': 0, 'title': 'Hurricane Philippe (2005)'}, {'ns': 0, 'title': 'Hurricane Rita'}, {'ns': 0, 'title': 'Hurricane Stan'}, {'ns': 0, 'title': 'Hurricane Vince (2005)'}, {'ns': 0, 'title': 'Hurricane Wilma'}, {'ns': 0, 'title': 'Inch of mercury'}, {'ns': 0, 'title': 'International Standard Book Number'}, {'ns': 0, 'title': 'List of Category 5 Atlantic hurricanes'}, {'ns': 0, 'title': 'List of storms in the 2005 Atlantic hurricane season'}, {'ns': 0, 'title': 'Louisiana'}, {'ns': 0, 'title': 'Meteorological history of Hurricane Katrina'}, {'ns': 0, 'title': 'National Hurricane Center'}, {'ns': 0, 'title': 'North Atlantic tropical cyclone'}, {'ns': 0, 'title': 'Outflow (meteorology)'}, {'ns': 0, 'title': 'Pascal (unit)'}, {'ns': 0, 'title': 'Puerto Rico'}, {'ns': 0, 'title': 'Saffir-Simpson Hurricane Scale'}, {'ns': 0, 'title': 'Saffir\u2013Simpson hurricane wind scale'}, {'ns': 0, 'title': 'Timeline of the 2005 Atlantic hurricane season'}, {'ns': 0, 'title': 'Tropical Storm Alpha (2005)'}, {'ns': 0, 'title': 'Tropical Storm Arlene (2005)'}, {'ns': 0, 'title': 'Tropical Storm Bret (2005)'}, {'ns': 0, 'title': 'Tropical Storm Delta (2005)'}, {'ns': 0, 'title': 'Tropical Storm Franklin (2005)'}, {'ns': 0, 'title': 'Tropical Storm Gamma'}, {'ns': 0, 'title': 'Tropical Storm Gert (2005)'}, {'ns': 0, 'title': 'Tropical Storm Jose (2005)'}, {'ns': 0, 'title': 'Tropical Storm Tammy (2005)'}, {'ns': 0, 'title': 'Tropical Storm Zeta'}, {'ns': 0, 'title': 'Tropical cyclone'}, {'ns': 0, 'title': 'Tropical cyclone scales'}, {'ns': 0, 'title': 'Tropical cyclone watches and warnings'}, {'ns': 0, 'title': 'Tropical wave'}, {'ns': 0, 'title': 'Wind shear'}], 'title': 'Tropical Depression Ten (2005)'}}}, 'limits': {'links': 500}}, 90 | 91 | (('cllimit', 'max'), ('prop', 'categories'), ('titles', 'Celtuce')): 92 | {"query":{"pages":{"1868108":{"pageid":1868108,"ns":0,"title":"Celtuce","categories":[{"ns":14,"title":"All articles lacking sources"},{"ns":14,"title":"All stub articles"},{"ns":14,"title":"Articles containing Chinese-language text"},{"ns":14,"title":"Articles lacking sources from December 2009"},{"ns":14,"title":"Stem vegetables"},{"ns":14,"title":"Vegetable stubs"}]}}},"limits":{"categories":500}}, 93 | 94 | (('cllimit', 'max'), ('prop', 'categories'), ('titles', 'Tropical Depression Ten (2005)')): 95 | {"query":{"pages":{"21196082":{"pageid":21196082,"ns":0,"title":"Tropical Depression Ten (2005)","categories":[{"ns":14,"title":"2005 Atlantic hurricane season"},{"ns":14,"title":"Articles with hAudio microformats"},{"ns":14,"title":"Atlantic tropical depressions"},{"ns":14,"title":"CS1 errors: dates"},{"ns":14,"title":"Commons category with local link same as on Wikidata"},{"ns":14,"title":"Featured articles"},{"ns":14,"title":"Hurricane Katrina"},{"ns":14,"title":"Spoken articles"}]}}},"limits":{"categories":500}}, 96 | 97 | (('prop', 'revisions'), ('rvlimit', 1), ('rvparse', ''), ('rvprop', 'content'), ('titles', 'Celtuce')): 98 | {'query-continue': {'revisions': {'rvcontinue': 547842204}}, 'query': {'pages': {'1868108': {'ns': 0, 'pageid': 1868108, 'revisions': [{'*': '\n
Celtuce stems & heads
\n

Celtuce (Lactuca sativa var. asparagina, augustana, or angustata), also called stem lettuce, celery lettuce, asparagus lettuce, or Chinese lettuce, IPA (UK,US) /\u02c8s\u025blt.\u0259s/, is a cultivar of lettuce grown primarily for its thick stem, used as a vegetable. It is especially popular in China, and is called wosun (Chinese: \u83b4\u7b0b; pinyin: w\u014ds\u016dn) or woju (Chinese: \u83b4\u82e3; pinyin: w\u014dj\xf9) (although the latter name may also be used to mean lettuce in general).\n

\n
Celtuce (foreground) for sale in Lhasa
\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
Celtuce, raw\n\n
Nutritional value per 100 g (3.5 oz)\n
Energy\n 75 kJ (18 kcal)\n
Carbohydrates\n 3.65 g\n
- Dietary fiber\n 1.7 g\n
Fat\n 0.3 g\n
Protein\n 0.85 g\n
Vitamin A equiv.\n 175 \u03bcg (22%)\n
Thiamine (vit. B1)\n 0.055 mg (5%)\n
Riboflavin (vit. B2)\n 0.07 mg (6%)\n
Niacin (vit. B3)\n 0.55 mg (4%)\n
Pantothenic acid (B5)\n 0.183 mg (4%)\n
Vitamin B6\n 0.05 mg (4%)\n
Folate (vit. B9)\n 46 \u03bcg (12%)\n
Vitamin C\n 19.5 mg (23%)\n
Calcium\n 39 mg (4%)\n
Iron\n 0.55 mg (4%)\n
Magnesium\n 28 mg (8%)\n
Manganese\n 0.688 mg (33%)\n
Phosphorus\n 39 mg (6%)\n
Potassium\n 330 mg (7%)\n
Sodium\n 11 mg (1%)\n
Zinc\n 0.27 mg (3%)\n
Link to USDA Database entry
Percentages are roughly approximated
using US recommendations for adults.
Source: USDA Nutrient Database\n
\n

The stem is usually harvested at a length of around 15\u201320 cm and a diameter of around 3\u20134 cm. It is crisp, moist, and mildly flavored, and typically prepared by slicing and then stir frying with more strongly flavored ingredients.\n


\n

\n\n\n\n\n'}], 'title': 'Celtuce'}}}}, 99 | 100 | (('action', 'parse'), ('prop', 'sections'), ('titles', 'Tropical Depression Ten (2005)')): 101 | {'parse': {'sections': [{'index': '1', 'level': '2', 'fromtitle': 'Tropical_Depression_Ten_(2005)', 'toclevel': 1, 'number': '1', 'byteoffset': 1369, 'line': 'Meteorological history', 'anchor': 'Meteorological_history'}, {'index': '2', 'level': '2', 'fromtitle': 'Tropical_Depression_Ten_(2005)', 'toclevel': 1, 'number': '2', 'byteoffset': 6248, 'line': 'Impact', 'anchor': 'Impact'}, {'index': '3', 'level': '2', 'fromtitle': 'Tropical_Depression_Ten_(2005)', 'toclevel': 1, 'number': '3', 'byteoffset': 7678, 'line': 'See also', 'anchor': 'See_also'}, {'index': '4', 'level': '2', 'fromtitle': 'Tropical_Depression_Ten_(2005)', 'toclevel': 1, 'number': '4', 'byteoffset': 7885, 'line': 'References', 'anchor': 'References'}, {'index': '5', 'level': '2', 'fromtitle': 'Tropical_Depression_Ten_(2005)', 'toclevel': 1, 'number': '5', 'byteoffset': 7917, 'line': 'External links', 'anchor': 'External_links'}], 'title': 'Tropical Depression Ten (2005)'}}, 102 | 103 | (('limit', 10), ('list', 'search'), ('srlimit', 10), ('srprop', ''), ('srsearch', 'Barack Obama')): 104 | {'query-continue': {'search': {'sroffset': 10}}, 'query': {'searchinfo': {'totalhits': 12987}, 'search': [{'ns': 0, 'title': 'Barack Obama'}, {'ns': 0, 'title': 'Barack Obama, Sr.'}, {'ns': 0, 'title': 'Presidency of Barack Obama'}, {'ns': 0, 'title': 'Barack Obama presidential campaign, 2008'}, {'ns': 0, 'title': 'List of federal judges appointed by Barack Obama'}, {'ns': 0, 'title': 'Barack Obama in comics'}, {'ns': 0, 'title': 'Political positions of Barack Obama'}, {'ns': 0, 'title': 'Barack Obama on social media'}, {'ns': 0, 'title': 'List of Batman: The Brave and the Bold characters'}, {'ns': 0, 'title': 'Family of Barack Obama'}]}, 'warnings': {'main': {'*': "Unrecognized parameter: 'limit'"}}}, 105 | 106 | (('limit', 3), ('list', 'search'), ('srlimit', 3), ('srprop', ''), ('srsearch', 'Porsche')): 107 | {'query-continue': {'search': {'sroffset': 3}}, 'query': {'searchinfo': {'totalhits': 5335}, 'search': [{'ns': 0, 'title': 'Porsche'}, {'ns': 0, 'title': 'Porsche in motorsport'}, {'ns': 0, 'title': 'Porsche 911 GT3'}]}, 'warnings': {'main': {'*': "Unrecognized parameter: 'limit'"}}}, 108 | 109 | (('limit', 10), ('list', 'search'), ('srinfo', 'suggestion'), ('srlimit', 10), ('srprop', ''), ('srsearch', 'hallelulejah')): 110 | {'query': {'searchinfo': {'suggestion': 'hallelujah'}, 'search': []}, 'warnings': {'main': {'*': "Unrecognized parameter: 'limit'"}}}, 111 | 112 | (('limit', 10), ('list', 'search'), ('srinfo', 'suggestion'), ('srlimit', 10), ('srprop', ''), ('srsearch', 'qmxjsudek')): 113 | {'query': {'search': []}, 'warnings': {'main': {'*': "Unrecognized parameter: 'limit'"}}}, 114 | 115 | (('inprop', 'url'), ('pageids', 1868108), ('ppprop', 'disambiguation'), ('prop', 'info|pageprops'), ('redirects', '')): 116 | {'query': {'pages': {'1868108': {'lastrevid': 575687826, 'pageid': 1868108, 'title': 'Celtuce', 'editurl': 'http://en.wikipedia.org/w/index.php?title=Celtuce&action=edit', 'counter': '', 'length': 1960, 'contentmodel': 'wikitext', 'pagelanguage': 'en', 'touched': '2014-01-12T09:30:00Z', 'ns': 0, 'fullurl': 'http://en.wikipedia.org/wiki/Celtuce'}}}}, 117 | 118 | (('colimit', 'max'), ('prop', 'coordinates'), ('titles', 'Great Wall of China')): 119 | {'query': {'pages': {'5094570': {'ns': 0, 'pageid': 5094570, 'coordinates': [{'lat': 40.6769, 'globe': 'earth', 'lon': 117.232, 'primary': ''}], 'title': 'Great Wall of China'}}}, 'limits': {'extlinks': 500}}, 120 | 121 | (('gscoord', '40.67693|117.23193'), ('gslimit', 10), ('gsradius', 1000), ('list', 'geosearch')): 122 | {'query': {'geosearch': [{'pageid': 5094570, 'title': 'Great Wall of China', 'lon': 117.232, 'primary': '', 'lat': 40.6769, 'dist': 6.8, 'ns': 0}]}}, 123 | 124 | (('gscoord', '40.67693|117.23193'), ('gslimit', 10), ('gsradius', 10000), ('list', 'geosearch')): 125 | {'query': {'geosearch': [{'pageid': 5094570, 'title': 'Great Wall of China', 'lon': 117.232, 'primary': '', 'lat': 40.6769, 'dist': 6.8, 'ns': 0}, {'pageid': 10135375, 'title': 'Jinshanling', 'lon': 117.244, 'primary': '', 'lat': 40.6764, 'dist': 1019.6, 'ns': 0}]}}, 126 | 127 | (('gscoord', '40.67693|117.23193'), ('gslimit', 10), ('gsradius', 1000), ('list', 'geosearch'), ('titles', 'Great Wall of China')): 128 | {'query': {'geosearch': [{'pageid': 5094570, 'title': 'Great Wall of China', 'lon': 117.232, 'primary': '', 'lat': 40.6769, 'dist': 6.8, 'ns': 0}]}}, 129 | 130 | (('gscoord', '40.67693|117.23193'), ('gslimit', 10), ('gsradius', 1000), ('list', 'geosearch'), ('titles', 'Test')): 131 | {'query': {'geosearch': []}}, 132 | }, 133 | 134 | "data": { 135 | "celtuce.content": 'Celtuce (Lactuca sativa var. asparagina, augustana, or angustata), also called stem lettuce, celery lettuce, asparagus lettuce, or Chinese lettuce, IPA (UK,US) /\u02c8s\u025blt.\u0259s/, is a cultivar of lettuce grown primarily for its thick stem, used as a vegetable. It is especially popular in China, and is called wosun (Chinese: \u83b4\u7b0b; pinyin: w\u014ds\u016dn) or woju (Chinese: \u83b4\u82e3; pinyin: w\u014dj\xf9) (although the latter name may also be used to mean lettuce in general).\n\nThe stem is usually harvested at a length of around 15\u201320 cm and a diameter of around 3\u20134 cm. It is crisp, moist, and mildly flavored, and typically prepared by slicing and then stir frying with more strongly flavored ingredients.\n\nDown: Photos of the celtuce, chinese lettuce or "Wosun" taken in the province of Girona (Catalonia, Spain, Europe) in June 2013\nCeltuce Nutritional content', 136 | 137 | "celtuce.parentid": 574302108, 138 | 139 | "celtuce.revid": 575687826, 140 | 141 | "celtuce.summary": "Celtuce (Lactuca sativa var. asparagina, augustana, or angustata), also called stem lettuce, celery lettuce, asparagus lettuce, or Chinese lettuce, IPA (UK,US) /\u02c8s\u025blt.\u0259s/, is a cultivar of lettuce grown primarily for its thick stem, used as a vegetable. It is especially popular in China, and is called wosun (Chinese: \u83b4\u7b0b; pinyin: w\u014ds\u016dn) or woju (Chinese: \u83b4\u82e3; pinyin: w\u014dj\xf9) (although the latter name may also be used to mean lettuce in general).\n\nThe stem is usually harvested at a length of around 15\u201320 cm and a diameter of around 3\u20134 cm. It is crisp, moist, and mildly flavored, and typically prepared by slicing and then stir frying with more strongly flavored ingredients.", 142 | 143 | "celtuce.images": ['http://upload.wikimedia.org/wikipedia/commons/7/79/VegCorn.jpg', 'http://upload.wikimedia.org/wikipedia/commons/8/87/Celtuce.jpg', 'http://upload.wikimedia.org/wikipedia/commons/d/dc/The_farmer%27s_market_near_the_Potala_in_Lhasa.jpg', 'http://upload.wikimedia.org/wikipedia/en/9/99/Question_book-new.svg'], 144 | 145 | "celtuce.references": ['http://ndb.nal.usda.gov/ndb/search/list', 'http://ndb.nal.usda.gov/ndb/search/list?qlookup=11145&format=Full'], 146 | 147 | "celtuce.links": ['Calcium', 'Carbohydrate', 'Chinese language', 'Dietary Reference Intake', 'Dietary fiber', 'Fat', 'Folate', 'Food energy', 'Iron', 'Lettuce', 'Lhasa', 'Magnesium in biology', 'Manganese', 'Niacin', 'Pantothenic acid', 'Phosphorus', 'Pinyin', 'Plant stem', 'Potassium', 'Protein (nutrient)', 'Riboflavin', 'Sodium', 'Stir frying', 'Thiamine', 'Vegetable', 'Vitamin A', 'Vitamin B6', 'Vitamin C', 'Zinc'], 148 | 149 | "celtuce.categories": ['All articles lacking sources', 'All stub articles', 'Articles containing Chinese-language text', 'Articles lacking sources from December 2009', 'Stem vegetables', 'Vegetable stubs'], 150 | 151 | "celtuce.html": '\n
Celtuce stems & heads
\n

Celtuce (Lactuca sativa var. asparagina, augustana, or angustata), also called stem lettuce, celery lettuce, asparagus lettuce, or Chinese lettuce, IPA (UK,US) /\u02c8s\u025blt.\u0259s/, is a cultivar of lettuce grown primarily for its thick stem, used as a vegetable. It is especially popular in China, and is called wosun (Chinese: \u83b4\u7b0b; pinyin: w\u014ds\u016dn) or woju (Chinese: \u83b4\u82e3; pinyin: w\u014dj\xf9) (although the latter name may also be used to mean lettuce in general).\n

\n
Celtuce (foreground) for sale in Lhasa
\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
Celtuce, raw\n\n
Nutritional value per 100 g (3.5 oz)\n
Energy\n 75 kJ (18 kcal)\n
Carbohydrates\n 3.65 g\n
- Dietary fiber\n 1.7 g\n
Fat\n 0.3 g\n
Protein\n 0.85 g\n
Vitamin A equiv.\n 175 \u03bcg (22%)\n
Thiamine (vit. B1)\n 0.055 mg (5%)\n
Riboflavin (vit. B2)\n 0.07 mg (6%)\n
Niacin (vit. B3)\n 0.55 mg (4%)\n
Pantothenic acid (B5)\n 0.183 mg (4%)\n
Vitamin B6\n 0.05 mg (4%)\n
Folate (vit. B9)\n 46 \u03bcg (12%)\n
Vitamin C\n 19.5 mg (23%)\n
Calcium\n 39 mg (4%)\n
Iron\n 0.55 mg (4%)\n
Magnesium\n 28 mg (8%)\n
Manganese\n 0.688 mg (33%)\n
Phosphorus\n 39 mg (6%)\n
Potassium\n 330 mg (7%)\n
Sodium\n 11 mg (1%)\n
Zinc\n 0.27 mg (3%)\n
Link to USDA Database entry
Percentages are roughly approximated
using US recommendations for adults.
Source: USDA Nutrient Database\n
\n

The stem is usually harvested at a length of around 15\u201320 cm and a diameter of around 3\u20134 cm. It is crisp, moist, and mildly flavored, and typically prepared by slicing and then stir frying with more strongly flavored ingredients.\n


\n

\n\n\n\n\n', 152 | 153 | "cyclone.content": 'Tropical Depression Ten was the tenth tropical cyclone of the record-breaking 2005 Atlantic hurricane season. It formed on August 13 from a tropical wave that emerged from the west coast of Africa on August 8. As a result of strong wind shear, the depression remained weak and did not strengthen beyond tropical depression status. The cyclone degenerated on August 14, although its remnants partially contributed to the formation of Tropical Depression Twelve, which eventually intensified into Hurricane Katrina. The cyclone had no effect on land, and did not directly result in any fatalities or damage.\n\n\n== Meteorological history ==\n\nOn August 8, a tropical wave emerged from the west coast of Africa and entered the Atlantic Ocean. Tracking towards the west, the depression began to exhibit signs of convective organization on August 11. The system continued to develop, and it is estimated that Tropical Depression Ten formed at 1200 UTC on August 13. At the time, it was located about 1,600 miles (2,600 km) east of Barbados. Upon its designation, the depression consisted of a large area of thunderstorm activity, with curved banding features and expanding outflow. However, the environmental conditions were predicted to quickly become unfavorable. The depression moved erratically and slowly towards the west, and wind shear inhibited any significant intensification. Late on August 13, it was "beginning to look like Irene-junior as it undergoes southwesterly mid-level shear beneath the otherwise favorable upper-level outflow pattern". The wind shear was expected to relent within 48 hours, prompting some forecast models to suggest the depression would eventually attain hurricane status.\nBy early August 14, the shear had substantially disrupted the storm, leaving the low-level center of circulation exposed from the area of convection, which was also deteriorating. After meandering, the storm began to move westward. Forecasters expected it to resume a northwestward track as high pressure to the south of Bermuda was forecasted to weaken and another high was predicted to form southwest of the Azores. By 1800 UTC on August 14, the strong shear had further weakened the storm, and it no longer met the criteria for a tropical cyclone. It degenerated into a remnant low, and the National Hurricane Center issued their final advisory on the cyclone. Moving westward, it occasionally produced bursts of convective activity, before dissipating on August 18.\nTropical Depression Twelve formed over the southeastern Bahamas at 2100 UTC on August 23, partially from the remains of Tropical Depression Ten. While the normal standards for numbering tropical depressions in the Atlantic stipulate that the initial designation be retained when a depression regenerates, satellite imagery indicated that a second tropical wave had combined with Tropical Depression Ten north of Puerto Rico to form a new, more complex weather system, which was then designated as Tropical Depression Twelve. In a re-analysis, it was found that the low-level circulation of Tropical Depression Ten had completely detached and dissipated; only the remnant mid-level circulation moved on and merged with the second tropical wave. As a result, the criteria for keeping the same name and identity were not met. Tropical Depression Twelve later became Hurricane Katrina.\n\n\n== Impact ==\nBecause Tropical Depression Ten never approached land as a tropical cyclone, no tropical cyclone watches and warnings were issued for any land masses. No effects, damages, or fatalities were reported, and no ships reported tropical storm-force winds in association with the depression. The system did not attain tropical storm status; as such, it was not given a name by the National Hurricane Center. The storm partially contributed to the formation of Hurricane Katrina, which became a Category 5 hurricane on the Saffir-Simpson Hurricane Scale and made landfall in Louisiana, causing catastrophic damage. Katrina was the costliest hurricane, and one of the five deadliest, in the history of the United States.\n\n\n== See also ==\n\nMeteorological history of Hurricane Katrina\nList of storms in the 2005 Atlantic hurricane season\nTimeline of the 2005 Atlantic hurricane season\n\n\n== References ==\n\n\n== External links ==\n\nTropical Depression Ten Tropical Cyclone Report\nTropical Depression Ten advisory archive', 154 | 155 | "cyclone.revid": 572715399, 156 | 157 | "cyclone.parentid": 539367750, 158 | 159 | "cyclone.summary": 'Tropical Depression Ten was the tenth tropical cyclone of the record-breaking 2005 Atlantic hurricane season. It formed on August 13 from a tropical wave that emerged from the west coast of Africa on August 8. As a result of strong wind shear, the depression remained weak and did not strengthen beyond tropical depression status. The cyclone degenerated on August 14, although its remnants partially contributed to the formation of Tropical Depression Twelve, which eventually intensified into Hurricane Katrina. The cyclone had no effect on land, and did not directly result in any fatalities or damage.\n\n', 160 | 161 | "cyclone.images": ['http://upload.wikimedia.org/wikipedia/commons/3/33/Tropical_Depression_Ten_%282005%29.ogg', 'http://upload.wikimedia.org/wikipedia/commons/3/37/People_icon.svg', 'http://upload.wikimedia.org/wikipedia/commons/4/47/Sound-icon.svg', 'http://upload.wikimedia.org/wikipedia/commons/4/4a/TD_10_August_13%2C_2005.jpg', 'http://upload.wikimedia.org/wikipedia/commons/7/7d/Tropical_Depression_10_%282005%29.png', 'http://upload.wikimedia.org/wikipedia/commons/8/89/Cyclone_Catarina_from_the_ISS_on_March_26_2004.JPG', 'http://upload.wikimedia.org/wikipedia/commons/8/89/Symbol_book_class2.svg', 'http://upload.wikimedia.org/wikipedia/commons/a/a5/10-L_2005_track.png', 'http://upload.wikimedia.org/wikipedia/commons/e/e0/2005_Atlantic_hurricane_season_summary_map.png', 'http://upload.wikimedia.org/wikipedia/en/4/48/Folder_Hexagonal_Icon.svg', 'http://upload.wikimedia.org/wikipedia/en/4/4a/Commons-logo.svg', 'http://upload.wikimedia.org/wikipedia/en/e/e7/Cscr-featured.svg', 'http://upload.wikimedia.org/wikipedia/en/f/fd/Portal-puzzle.svg'], 162 | 163 | "cyclone.references": ['http://books.google.com/?id=-a8DRl1HuwoC&q=%22tropical+depression+ten%22+2005&dq=%22tropical+depression+ten%22+2005', 'http://facstaff.unca.edu/chennon/research/documents/erb_ncur2006_preprint.pdf', 'http://www.nhc.noaa.gov/archive/2005/TEN.shtml?', 'http://www.nhc.noaa.gov/archive/2005/dis/al102005.discus.001.shtml?', 'http://www.nhc.noaa.gov/archive/2005/dis/al102005.discus.002.shtml?', 'http://www.nhc.noaa.gov/archive/2005/dis/al102005.discus.003.shtml?', 'http://www.nhc.noaa.gov/archive/2005/dis/al122005.discus.001.shtml', 'http://www.nhc.noaa.gov/pdf/TCR-AL102005_Ten.pdf', 'http://www.nhc.noaa.gov/pdf/TCR-AL122005_Katrina.pdf', 'http://www.wptv.com/content/chopper5/story/Capt-Julie-Reports-On-Hurricane-Katrina/q__v8S2TZES2GiccRTQ2bw.cspx'], 164 | 165 | "cyclone.links": ['2005 Atlantic hurricane season', '2005 Azores subtropical storm', 'Atlantic Ocean', 'Atmospheric circulation', 'Atmospheric convection', 'Azores', 'Bahamas', 'Bar (unit)', 'Barbados', 'Bermuda', 'High pressure area', 'Hurricane Beta', 'Hurricane Cindy (2005)', 'Hurricane Dennis', 'Hurricane Emily (2005)', 'Hurricane Epsilon', 'Hurricane Irene (2005)', 'Hurricane Katrina', 'Hurricane Maria (2005)', 'Hurricane Nate (2005)', 'Hurricane Ophelia (2005)', 'Hurricane Philippe (2005)', 'Hurricane Rita', 'Hurricane Stan', 'Hurricane Vince (2005)', 'Hurricane Wilma', 'Inch of mercury', 'International Standard Book Number', 'List of Category 5 Atlantic hurricanes', 'List of storms in the 2005 Atlantic hurricane season', 'Louisiana', 'Meteorological history of Hurricane Katrina', 'National Hurricane Center', 'North Atlantic tropical cyclone', 'Outflow (meteorology)', 'Pascal (unit)', 'Puerto Rico', 'Saffir-Simpson Hurricane Scale', 'Saffir\u2013Simpson hurricane wind scale', 'Timeline of the 2005 Atlantic hurricane season', 'Tropical Storm Alpha (2005)', 'Tropical Storm Arlene (2005)', 'Tropical Storm Bret (2005)', 'Tropical Storm Delta (2005)', 'Tropical Storm Franklin (2005)', 'Tropical Storm Gamma', 'Tropical Storm Gert (2005)', 'Tropical Storm Jose (2005)', 'Tropical Storm Tammy (2005)', 'Tropical Storm Zeta', 'Tropical cyclone', 'Tropical cyclone scales', 'Tropical cyclone watches and warnings', 'Tropical wave', 'Wind shear'], 166 | 167 | "cyclone.categories": ['2005 Atlantic hurricane season', 'Articles with hAudio microformats', 'Atlantic tropical depressions', 'CS1 errors: dates', 'Commons category with local link same as on Wikidata', 'Featured articles', 'Hurricane Katrina', 'Spoken articles'], 168 | 169 | "cyclone.sections": ['External links', 'Impact', 'Meteorological history', 'References', 'See also'], 170 | 171 | "cyclone.section.impact": 'Because Tropical Depression Ten never approached land as a tropical cyclone, no tropical cyclone watches and warnings were issued for any land masses. No effects, damages, or fatalities were reported, and no ships reported tropical storm-force winds in association with the depression. The system did not attain tropical storm status; as such, it was not given a name by the National Hurricane Center. The storm partially contributed to the formation of Hurricane Katrina, which became a Category 5 hurricane on the Saffir-Simpson Hurricane Scale and made landfall in Louisiana, causing catastrophic damage. Katrina was the costliest hurricane, and one of the five deadliest, in the history of the United States.', 172 | 173 | "barack.search": ['Barack Obama', 'Barack Obama, Sr.', 'Presidency of Barack Obama', 'Barack Obama presidential campaign, 2008', 'List of federal judges appointed by Barack Obama', 'Barack Obama in comics', 'Political positions of Barack Obama', 'Barack Obama on social media', 'List of Batman: The Brave and the Bold characters', 'Family of Barack Obama'], 174 | 175 | "porsche.search": ['Porsche', 'Porsche in motorsport', 'Porsche 911 GT3'], 176 | 177 | "great_wall_of_china.coordinates.lat": '40.677', 178 | "great_wall_of_china.coordinates.lon": '117.232', 179 | 180 | "great_wall_of_china.geo_seach": ['Great Wall of China'], 181 | 182 | "great_wall_of_china.geo_seach_with_radius": ['Great Wall of China', 'Jinshanling'], 183 | 184 | "great_wall_of_china.geo_seach_with_existing_article_name": ['Great Wall of China'], 185 | 186 | "great_wall_of_china.geo_seach_with_non_existing_article_name": [], 187 | } 188 | } 189 | --------------------------------------------------------------------------------