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
>>> print(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', "Forester's Arms", 'Forester (Burgh de Rott Ramble)', 'Forester', 'Forest Beyond', 'Nemi Forest', 'Dense forest', 'Jungle forester', 'Freaky Forester', "Bartender (Forester's Arms)"]

>>> 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+.

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.1.4.tar.gz (11.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

fandom_py-0.1.4-py3-none-any.whl (10.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: fandom-py-0.1.4.tar.gz
  • Upload date:
  • Size: 11.9 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.1.4.tar.gz
Algorithm Hash digest
SHA256 79d0be7afe245e2156ca0c2d4a5fd410040c0824627e286ef19e7d6bccab5a91
MD5 7f40aae7a12e07a465362db3d2a154fe
BLAKE2b-256 0bab9ada379b9497fda413e425a220392568fc33843579a8019a1a024ef5a57a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fandom_py-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 10.9 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.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 9c181c5fa7ee038aba0b1a2f0b67771870f48df06e599c68768cc900d00d89af
MD5 5a6f54a16616823fca2cdb1cb1910dd3
BLAKE2b-256 75ccbf90cf8fca74ca0d45b601bfd79e61d59458ea14f05c568100970d53995a

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