Skip to main content

a package to simplify the wikipedia api

Project description

simple wiki WIP

a simple warper for the wikipedia api

how to use

install

pip install simplewiki

quick start

start by setting up

import simplewiki

wiki = simplewiki.wikipedia()

then you can get some search results

wiki.search("cats",5)

this will return a list of results and page ids:

[('Bengal cat', '63064'), ('Cat', '6678'), ('Cats, Cats, Cats!', '68799268'), ('Cats (musical)', '215013'), ('Tabby cat', '6412655')]

you can take one of the page ids a summarize it

wiki.summary(6678)

this will return a tuple with the title and summary

('Cat', 'The cat (Felis catus) is a domestic species of small carnivorous mammal. It is the only domesticated species in the-')

but what if we just want to get the page?

wiki.html(6678)

this will return the raw html as a string:

...link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1038841319"/><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r10...

congrats you now have the wikipedia api at you fingertips

commands

  • wiki.search(keyword:str,limit:int) > results:list[tuple]
  • wiki.summarize(page_id:int) > summary:str
  • wiki.html(page_id:int) > html:str
  • wiki.get_url(page_id:int) > url:str

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

simplewiki-1.0.5.tar.gz (3.5 kB view details)

Uploaded Source

File details

Details for the file simplewiki-1.0.5.tar.gz.

File metadata

  • Download URL: simplewiki-1.0.5.tar.gz
  • Upload date:
  • Size: 3.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.4

File hashes

Hashes for simplewiki-1.0.5.tar.gz
Algorithm Hash digest
SHA256 f1ed11f5e078b49766590db031624b21fdb260f544d508265ec0e83570d136ea
MD5 c7ab0ae2693dfe50eb6b47a37d14ecb8
BLAKE2b-256 23e48038049864e513807c5c2b2a0ba4285fb45070c242a707e2c6a7fd596d0b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page