Skip to main content

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

Metadata

Release files for fandom-py 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for fandom-py 0.2.1
File Size Uploaded Provenance Actions
fandom-py-0.2.1.tar.gz 13.0 kB Without provenance Details for fandom-py-0.2.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for fandom-py 0.2.1
File Interpreter ABI Platform Actions
fandom_py-0.2.1-py3-none-any.whl Python 3 none any Details for fandom_py-0.2.1-py3-none-any.whl

Total release size: 25.2 kB

Release files / fandom-py-0.2.1.tar.gz

Download URL fandom-py-0.2.1.tar.gz
Size 13.0 kB
Tags Source
SHA-256 checksum
How to use checksums
e78ea9927f8ae516d400291f1e8a59b6e0601529b20212ac422264f32ea676d0
BLAKE2b-256 checksum
How to use checksums
115281e7ca6fadefc57ae0586d056581e65f9e2b91aa496210b38472437a6a8f
Upload date
Uploaded using Trusted Publishing?
What is 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

Release files / fandom_py-0.2.1-py3-none-any.whl

Download URL fandom_py-0.2.1-py3-none-any.whl
Size 12.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
67870618f1466c4f989a5f7eedd041ceccd1a3434d235a9feb6c74b2ccc7700e
BLAKE2b-256 checksum
How to use checksums
98079dc939c359748db752db1ea9fb64a709c1d55e559ab40ad177a414c3801f
Upload date
Uploaded using Trusted Publishing?
What is 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

Security for fandom-py 0.2.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page