Herdr UI
Herdr의 TUI가 뛰어나며, 창을 통해 추가되는 기능
Wikipedia API를 위한 파이썬 래퍼
A Pythonic wrapper for the Wikipedia API
개발 도구Python · ShellGitHub @goldsmith직접 설치운영자 미확인
써 보셨어요? 한 번만 눌러 주세요. 로그인은 필요 없어요.
개인 계정의 공개 저장소 소유자는 GitHub로 로그인해 운영자를 확인하고 소개를 직접 관리할 수 있습니다. 관리자 승인은 필요하지 않습니다.
로그인한 뒤 확인 파일을 만들어 이 저장소의 기본 브랜치에 30분 안에 커밋해 주세요. 다른 브랜치나 포크의 파일은 인정하지 않습니다. 파일을 올린 뒤 아래에서 확인하면 관리자 승인 없이 관리할 수 있습니다. 자격을 유지하려면 파일을 남겨 두세요.
로그인이 필요하면 로그인 화면으로 이동합니다. 로그인 후 이곳으로 돌아와 원하는 확인 버튼을 다시 눌러 주세요.
설치형 프로젝트는 배포 도메인 없이도 확인할 수 있습니다. 개인 저장소는 GitHub 로그인으로, 조직 저장소는 위의 저장소 확인 파일로 직접 확인해 주세요.
메이커가 쓴 소개는 위의 한 줄이 전부입니다. 더 자세한 내용은 저장소 README에서 읽을 수 있습니다. 저장소 README ↗
Wikipedia is a Python library that makes it easy to access and parse data from Wikipedia.
Search Wikipedia, get article summaries, get data like links and images
from a page, and more. Wikipedia wraps the MediaWiki API <https://www.mediawiki.org/wiki/API>__ so you can focus on using
Wikipedia data, not getting it.
.. code:: python
import wikipedia wikipedia.summary("Wikipedia", sentences=1) 'Wikipedia is a free online encyclopedia written and maintained by a community of volunteer editors, known as Wikipedians...'
wikipedia.search("Barack") ['Barack Obama', 'Barack Obama Sr.', 'Barack (disambiguation)', 'Family of Barack Obama', ...]
ny = wikipedia.page("New York City") ny.title 'New York City' ny.url 'https://en.wikipedia.org/wiki/New_York_City' ny.content 'New York, often called New York City (NYC), is the most populous city in the United States...' ny.links[0] '116 John Street'
wikipedia.set_lang("fr") wikipedia.summary("Facebook", sentences=1) 'Facebook [ˈfeɪs.bʊk] (litt. ...'
To install Wikipedia, simply run:
::
$ pip install wikipedia
Wikipedia 1.5 supports Python 3.10 and newer. If you're still on an older
Python, pip install "wikipedia<1.5" will keep working the way it
always has.
Read the docs at https://wikipedia.readthedocs.io/.
Quickstart <https://wikipedia.readthedocs.io/en/latest/quickstart.html>__Full API <https://wikipedia.readthedocs.io/en/latest/code.html>__One small thing before you script away: Wikimedia asks that API clients say who they are, so please set a user agent with a way to reach you:
.. code:: python
wikipedia.set_user_agent("my-cool-project/1.0 (https://example.com/contact)")
The library takes care of the rest: requests go over HTTPS, share a
connection pool, give up after a 5-second connect / 15-second read timeout
(set_timeout if you want different limits), and retry transient
failures at most twice before raising RequestError or
HTTPTimeoutError. set_rate_limiting(True) keeps at least 50 ms
between requests if you want to be extra polite. Results are cached for
five minutes so asking twice doesn't cost Wikipedia a dime.
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 Pywikibot <https://www.mediawiki.org/wiki/Manual:Pywikibot>__
(or one of the other more advanced Python MediaWiki API wrappers <https://en.wikipedia.org/wiki/Wikipedia:Creating_a_bot#Python>__), which
has a larger API, rate limiting, and other features so we can be
considerate of the MediaWiki infrastructure.
Thirteen years of gentle maintenance, collected: exact titles resolve
before suggestions, disambiguation pages raise instead of silently
picking a different article for you, redirects and sections behave,
missing properties return [] or None instead of exploding, and
page objects remember which language you fetched them in. Python 3.10+
only, real packaging, and an offline test suite that doesn't hammer the
API. See CHANGELOG.md for the full list and CONTRIBUTIONS.md for
the many people whose pull requests informed it.
To run tests, clone the repository on GitHub <https://github.com/goldsmith/Wikipedia>__, then run:
::
$ pip install -e '.[dev]' $ bash runtests
The test suite runs offline — it stubs HTTP rather than pestering
Wikipedia. python scripts/live_smoke.py runs the opt-in live checks
against the real API (rate limited, capped at 30 requests), and
pip install -e '.[docs]' plus sphinx -b html docs/source docs/_build/html builds the documentation.
MIT licensed. See the LICENSE file <https://github.com/goldsmith/Wikipedia/blob/master/LICENSE>__ for
full details.
wiki-api <https://github.com/richardasaurus/wiki-api>__ by
@richardasaurus for inspirationWikimedia Foundation <https://wikimediafoundation.org/>__ for giving
the world free access to dataREADME 전체를 불러오는 중입니다.
README 전문 보기 ↗