Skip to content

jamc-code/dnfo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

dnfo

Search the DnD5e API and return relevant information

Requirements

  • Python ^3.7
  • appdirs>=1.4.4 for finding what directories to store data in (helps this function as a platform-independent application)
  • GitPython>=3.1.14 for downloading the database repository
  • pymongo>=3.11.3 for querying a local database
  • requests>=2.25.1 for querying the database at https://dnd5eapi.co/api
  • rich>=9.13.0 for formatting retrieved information

Optional Requirements

  • If you want to query a local database (it's faster and works offline!), install mongodb and make sure it's running on the default host and port.

Usage

dnfo takes an argument for an endpoint and an index of that endpoint, in the format of python3 dnfo \[endpoint] \[index]. To get available endpoints, run the command with no arguments, or a help flag (-h|--help|help).
To get available indexes of an endpoint, run the command without an index: python3 dnfo \[endpoint].

Using a Local Database

  1. Make sure mongod is running on the default host and port.
  2. Run dnfo --build to build the database used by the DnD 5th Edition API.
  3. Run dnfo with the --local flag to use the local database instead of the online API.

Configuration

Coming soon...

TODO

  • Tests
  • Formatting of dictionaries as values in a dict
  • If disconnected from internet and database is built, use the db
  • Config file
    • Configurable host and port for mongo database
  • Store responses in a database
    • Populate the database and create a .lock file, with a regeneration if requested by the user
  • Print rows that fit the size of the command prompt
  • Store all options in arrays and check arguments against them
  • Format all received data in a rich Table

About

cli tool to parse the DnD 5e API

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Languages