Skip to main content

Ditto is a server that serves a static copy of PokeAPI's data.

Project description

image

Ditto

https://bulbapedia.bulbagarden.net/wiki/Ditto_(Pokémon)

This repository contains:

  • a static copy of the JSON data generated from PokeAPI based on Veekun’s data
  • a PokeAPI schema generated from the above data
  • a script to serve the data in the same form as PokeAPI
  • a script to crawl an instance of PokeAPI to regenerate the data
  • a script to analyze the generated data and produce a JSON Schema

Usage

This project is on Docker Hub. If you just want to run it, you just have to run one command. Replace 8080 with the port of your choice.

docker run -p 8080:80 pokesource/ditto

Development

If you plan to edit the project, you can install it locally for development. Poetry is required.

cd ~
git clone https://github.com/PokeAPI/ditto.git
cd ditto
poetry install

# now you can run ditto!
poetry run ditto --help

Advanced

You can manually update the data if necessary. If I abandon this project, here’s how to update it. It's a bit of an involved process.

Before starting, you’ll need to install Docker and Docker Compose.

These instructions assume you've already set up the project for development in ~/ditto.

First clone the PokeAPI repository:

cd ~
git clone https://github.com/PokeAPI/pokeapi.git

Apply the patch to disable rate limiting on your local PokeAPI:

# Assuming you have the repos in ~
cd ~/pokeapi
git apply ~/ditto/extra/disable-rate-limit.patch

Run PokeAPI using docker-compose:

docker volume create --name=redis_data
docker volume create --name=pg_data
docker-compose up -d

Build the PokeAPI database:

docker-compose exec app python manage.py migrate
docker-compose exec app python manage.py shell
from data.v2.build import build_all
build_all()

The above step can take a really long time to complete. Once it’s done, you can finally update Ditto’s data:

cd ~/ditto
rm -r ./data
poetry install
poetry run ditto clone --source http://localhost/ --destination ./data
poetry run ditto analyze --api-dir ./data/api --schema-dir ./data/schema

This will crawl your local instance of PokeAPI, copy all the data to ./data, and regenerate the schema. Once that's finished, you can serve the freshly updated data!

poetry run ditto serve --port 8080

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

pokeapi-ditto-0.2.0.tar.gz (9.4 kB view details)

Uploaded Source

Built Distribution

pokeapi_ditto-0.2.0-py3-none-any.whl (23.9 kB view details)

Uploaded Python 3

File details

Details for the file pokeapi-ditto-0.2.0.tar.gz.

File metadata

  • Download URL: pokeapi-ditto-0.2.0.tar.gz
  • Upload date:
  • Size: 9.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/0.11.5 CPython/3.6.6 Linux/4.4.0-17134-Microsoft

File hashes

Hashes for pokeapi-ditto-0.2.0.tar.gz
Algorithm Hash digest
SHA256 7fca2889f2ca91648e5fa4fd671e571401c369301a04d56023ce973dfc8b1109
MD5 d797ada60d39afb70ddececefc0a75a9
BLAKE2b-256 d7249af1996f2fdec24c85cf58316963d1add82b216427d1eecd0df0e3d74ee1

See more details on using hashes here.

File details

Details for the file pokeapi_ditto-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: pokeapi_ditto-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 23.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/0.11.5 CPython/3.6.6 Linux/4.4.0-17134-Microsoft

File hashes

Hashes for pokeapi_ditto-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7c8a88428aed8321c8e6dcdef3b5ff78ffee6a1d73f12714ba2161f7c9a029cd
MD5 189550e1df156c54d7fdabdc12cdda00
BLAKE2b-256 33cd14cd6b0c70c16102d9bab1b6376addf778a758236ccb4f53031cea4d34bb

See more details on using hashes here.

Supported by

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