Skip to main content

Fandom API wrapper for Python

Project description

fandom-py is a Python library that makes it easy to access and parse data from any Fandom website.

Search a Fandom, get article summaries, get data like links and images from a page, and more. fandom-py wraps the Fandom API so you can focus on using Fandom data, not getting it.

>>> import fandom
>>> fandom.summary("Banshee", "Runescape")
# Banshees are Slayer monsters that require level 15 Slayer to kill. They frequently drop 13 noted pure essence, making them an alternative source of essence. Additionally, banshees tend to frequently drop many different types of herbs. Mighty banshees are a higher-levelled alternative, if this is given as your Slayer assignment.

>>> fandom.search("Forest", "Runescape")
# [('Forest', 158584), ("Forester's Arms", 13771), ('Forester (Burgh de Rott Ramble)', 37816), ('Forester', 37518), ('Forest Beyond', 498451), ('Nemi Forest', 538558), ('Jungle forester', 68434), ('Freaky Forester', 6805), ("Bartender (Forester's Arms)", 543117), ('Dense forest', 83395)]

>>> fandom.set_wiki("Runescape")
>>> drakan = fandom.page("Castle Drakan")
>>> drakan.title
# u'Castle Drakan'
>>> drakan.url
# u'http://runescape.fandom.com/wiki/Castle_Drakan'
>>> drakan.plain_text
# u'Castle Drakan is the home of Lord Drakan, the vampyre lord of Morytania. Found just north of Meiyerditch, it looms over the Sanguinesti region'...

>>> fandom.set_lang("nl") # Dutch
>>> fandom.summary("Runes", "Runescape", sentences=1)
# Runes, of Magische runes zijn kleine gewichtloze steentjes waarmee spelers een spreuk kunnen uitvoeren.

Note: this library was designed for ease of use and simplicity, not for advanced use.

Installation

To install fandom-py, simply run:

$ pip install fandom-py

fandom-py is compatible with Python 3.9+.

Documentation

You can find the documentation for fandom-py here.

Tests

To run tests, clone the respository on GitHub, then run:

$ pip install -r requirements.txt
$ bash runtests.bat  # will run tests for python
$ runtests.bat # will run tests for python (windows)
$ python3 -m unittest discover -s fandom/tests -p '*test.py'  # manual style

in the root project directory.

License

MIT licensed. See the LICENSE file for full details.

Credits

  • wiki-api by @richardasaurus for inspiration

  • @nmoroze and @themichaelyang for feedback and suggestions

  • The Wikimedia Foundation for giving the world free access to data

  • @goldsmith for making such a fantastic library to fork

  • /u/captainmeta4 for giving the idea for a reddit bot to post game wiki info like auto-wiki bot

  • @timidger for writing the wikia code this is based on

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

fandom-py-0.2.1.tar.gz (13.0 kB view details)

Uploaded Source

Built Distribution

fandom_py-0.2.1-py3-none-any.whl (12.2 kB view details)

Uploaded Python 3

File details

Details for the file fandom-py-0.2.1.tar.gz.

File metadata

  • Download URL: fandom-py-0.2.1.tar.gz
  • Upload date:
  • Size: 13.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.4

File hashes

Hashes for fandom-py-0.2.1.tar.gz
Algorithm Hash digest
SHA256 e78ea9927f8ae516d400291f1e8a59b6e0601529b20212ac422264f32ea676d0
MD5 58e6cf0f7c53076e6eb63a40b3314afd
BLAKE2b-256 115281e7ca6fadefc57ae0586d056581e65f9e2b91aa496210b38472437a6a8f

See more details on using hashes here.

File details

Details for the file fandom_py-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: fandom_py-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 12.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.4

File hashes

Hashes for fandom_py-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 67870618f1466c4f989a5f7eedd041ceccd1a3434d235a9feb6c74b2ccc7700e
MD5 058b48ba0ebdca5f15041afdce45c180
BLAKE2b-256 98079dc939c359748db752db1ea9fb64a709c1d55e559ab40ad177a414c3801f

See more details on using hashes here.

Supported by

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