-
Notifications
You must be signed in to change notification settings - Fork 0
Quick Start
Xander Forrest edited this page Jan 21, 2024
·
1 revision
Send a POST request with content JSON to https://cobblemon.tools/api/v1/pokedex/search
import requests
url = "https://cobblemon.tools/api/v1/pokedex/search"
request = {
"types": ["fire"]
}
response = requests.post(url, json=request)
if (response.status_code == 200):
print(response.text)This Python example shows how to request every Pokemon that is a fire type. You can include multiple data points in your request to get a more specific list of Pokemon.
request = {
"types": ["fire"],
"implemented": True,
"ev_yields": ["defence"]
}This request would only return Pokemon who are a:
- A Fire Type
- Implemented in Cobblemon (have a model)
- Give Defence EVs when defeated
As of Cobblemon 1.4.0, this should just return Magcargo & Torkoal.
Lets edit our script to output the data in a prettier format.
import requests
import json
import pprint
pp = pprint.PrettyPrinter(depth=5)
url = "https://cobblemon.tools/api/v1/pokedex/search"
request = {
"types": ["fire"],
"implemented": True,
"ev_yields": ["defence"]
}
if response.status_code != 200:
print("Error getting data from API!")
exit(0)
results = json.loads(response.text)
pp.pprint(results)Running this (as of Cobblemon 1.4.0) will output:
{'results': [{'display_name': 'Magcargo',
'form': 'normal',
'generation': 2,
'national_dex': 219,
'types': ['fire', 'rock'],
'url': '/pokedex/pokemon/magcargo'},
{'display_name': 'Torkoal',
'form': 'normal',
'generation': 3,
'national_dex': 324,
'types': ['fire'],
'url': '/pokedex/pokemon/torkoal'}],
'status': 'ok'}