Having trouble creating JSON payload that contains (world of warcraft) races and the playable classes for...











up vote
2
down vote

favorite












I'm using Python, sqlalchemy ORM, Flask, and oauth stuff.
I'll try to specify this as much as possible...



I want to pull information from some online source (API, website, etc.) that will list out the playable races for World of Warcraft and then also have the playable classes for each race. I'm building an API for a final project in a college course and the Blizzard API only lists races and classes separately. It doesn't give me a good way to have the races and then the list of playable classes for each race.



Essentially, I want to be able to return a payload like the following:



"races": [
{
"name": race.name,
"faction": race.faction,
"description": race.description,
"link": url_for('race_info', raceName=race.name)
"classes: ['warrior', 'paladin', 'hunter']
}
for race in races
]


I could just go through and add this stuff manually into my database, but my professor is insisting we pull info from the web and put it directly into our database. He doesn't want us to hardcode anything into our database.



Alternatively, if someone can think of a way for me to take the JSONs I'm receiving from Blizzard's API and somehow use that info to do what I want without just hardcoding everything, I'm open to ideas.



Sorry if I didn't specify my needs enough.



Edit: I was asked for samples of the races and classes JSON. If I print out the results from a request for /race and /class I get the following...



/race ...
{'races': [{'description': 'test', 'faction': 'alliance', 'link': '/race/Human', 'name': 'Human'},... rest of races here



/class ...
{'classes': [{'class name': 'Warrior', 'link': '/class/Warrior', 'power type': 'rage'},... rest of classes here










share|improve this question















closed as off-topic by Barmar, Nick A, Nkosi, Fran, deceze Nov 22 at 13:05


This question appears to be off-topic. The users who voted to close gave this specific reason:


  • "Questions asking us to recommend or find a book, tool, software library, tutorial or other off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it." – Barmar, Nick A, Nkosi, Fran, deceze

If this question can be reworded to fit the rules in the help center, please edit the question.













  • Provide a sample of what the races and classes JSON's look like.
    – aneroid
    Nov 22 at 5:05










  • Do you mean a sample of what the JSON I'm giving to my user looks like or what the JSON I'm getting from the blizzard API looks like?
    – Patrick Conboy
    Nov 22 at 8:20










  • the 2nd one: what the JSON from Blizzard's API looks like, since we can't see samples on their site without signing up.
    – aneroid
    Nov 22 at 8:23










  • { "races": [ { "id": 1, "mask": 1, "side": "alliance", "name": "Human" },
    – Patrick Conboy
    Nov 22 at 8:29










  • { "classes": [ { "id": 1, "mask": 1, "powerType": "rage", "name": "Warrior" },
    – Patrick Conboy
    Nov 22 at 8:29















up vote
2
down vote

favorite












I'm using Python, sqlalchemy ORM, Flask, and oauth stuff.
I'll try to specify this as much as possible...



I want to pull information from some online source (API, website, etc.) that will list out the playable races for World of Warcraft and then also have the playable classes for each race. I'm building an API for a final project in a college course and the Blizzard API only lists races and classes separately. It doesn't give me a good way to have the races and then the list of playable classes for each race.



Essentially, I want to be able to return a payload like the following:



"races": [
{
"name": race.name,
"faction": race.faction,
"description": race.description,
"link": url_for('race_info', raceName=race.name)
"classes: ['warrior', 'paladin', 'hunter']
}
for race in races
]


I could just go through and add this stuff manually into my database, but my professor is insisting we pull info from the web and put it directly into our database. He doesn't want us to hardcode anything into our database.



Alternatively, if someone can think of a way for me to take the JSONs I'm receiving from Blizzard's API and somehow use that info to do what I want without just hardcoding everything, I'm open to ideas.



Sorry if I didn't specify my needs enough.



Edit: I was asked for samples of the races and classes JSON. If I print out the results from a request for /race and /class I get the following...



/race ...
{'races': [{'description': 'test', 'faction': 'alliance', 'link': '/race/Human', 'name': 'Human'},... rest of races here



/class ...
{'classes': [{'class name': 'Warrior', 'link': '/class/Warrior', 'power type': 'rage'},... rest of classes here










share|improve this question















closed as off-topic by Barmar, Nick A, Nkosi, Fran, deceze Nov 22 at 13:05


This question appears to be off-topic. The users who voted to close gave this specific reason:


  • "Questions asking us to recommend or find a book, tool, software library, tutorial or other off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it." – Barmar, Nick A, Nkosi, Fran, deceze

If this question can be reworded to fit the rules in the help center, please edit the question.













  • Provide a sample of what the races and classes JSON's look like.
    – aneroid
    Nov 22 at 5:05










  • Do you mean a sample of what the JSON I'm giving to my user looks like or what the JSON I'm getting from the blizzard API looks like?
    – Patrick Conboy
    Nov 22 at 8:20










  • the 2nd one: what the JSON from Blizzard's API looks like, since we can't see samples on their site without signing up.
    – aneroid
    Nov 22 at 8:23










  • { "races": [ { "id": 1, "mask": 1, "side": "alliance", "name": "Human" },
    – Patrick Conboy
    Nov 22 at 8:29










  • { "classes": [ { "id": 1, "mask": 1, "powerType": "rage", "name": "Warrior" },
    – Patrick Conboy
    Nov 22 at 8:29













up vote
2
down vote

favorite









up vote
2
down vote

favorite











I'm using Python, sqlalchemy ORM, Flask, and oauth stuff.
I'll try to specify this as much as possible...



I want to pull information from some online source (API, website, etc.) that will list out the playable races for World of Warcraft and then also have the playable classes for each race. I'm building an API for a final project in a college course and the Blizzard API only lists races and classes separately. It doesn't give me a good way to have the races and then the list of playable classes for each race.



Essentially, I want to be able to return a payload like the following:



"races": [
{
"name": race.name,
"faction": race.faction,
"description": race.description,
"link": url_for('race_info', raceName=race.name)
"classes: ['warrior', 'paladin', 'hunter']
}
for race in races
]


I could just go through and add this stuff manually into my database, but my professor is insisting we pull info from the web and put it directly into our database. He doesn't want us to hardcode anything into our database.



Alternatively, if someone can think of a way for me to take the JSONs I'm receiving from Blizzard's API and somehow use that info to do what I want without just hardcoding everything, I'm open to ideas.



Sorry if I didn't specify my needs enough.



Edit: I was asked for samples of the races and classes JSON. If I print out the results from a request for /race and /class I get the following...



/race ...
{'races': [{'description': 'test', 'faction': 'alliance', 'link': '/race/Human', 'name': 'Human'},... rest of races here



/class ...
{'classes': [{'class name': 'Warrior', 'link': '/class/Warrior', 'power type': 'rage'},... rest of classes here










share|improve this question















I'm using Python, sqlalchemy ORM, Flask, and oauth stuff.
I'll try to specify this as much as possible...



I want to pull information from some online source (API, website, etc.) that will list out the playable races for World of Warcraft and then also have the playable classes for each race. I'm building an API for a final project in a college course and the Blizzard API only lists races and classes separately. It doesn't give me a good way to have the races and then the list of playable classes for each race.



Essentially, I want to be able to return a payload like the following:



"races": [
{
"name": race.name,
"faction": race.faction,
"description": race.description,
"link": url_for('race_info', raceName=race.name)
"classes: ['warrior', 'paladin', 'hunter']
}
for race in races
]


I could just go through and add this stuff manually into my database, but my professor is insisting we pull info from the web and put it directly into our database. He doesn't want us to hardcode anything into our database.



Alternatively, if someone can think of a way for me to take the JSONs I'm receiving from Blizzard's API and somehow use that info to do what I want without just hardcoding everything, I'm open to ideas.



Sorry if I didn't specify my needs enough.



Edit: I was asked for samples of the races and classes JSON. If I print out the results from a request for /race and /class I get the following...



/race ...
{'races': [{'description': 'test', 'faction': 'alliance', 'link': '/race/Human', 'name': 'Human'},... rest of races here



/class ...
{'classes': [{'class name': 'Warrior', 'link': '/class/Warrior', 'power type': 'rage'},... rest of classes here







python api flask-sqlalchemy world-of-warcraft






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 22 at 19:05

























asked Nov 22 at 4:11









Patrick Conboy

214




214




closed as off-topic by Barmar, Nick A, Nkosi, Fran, deceze Nov 22 at 13:05


This question appears to be off-topic. The users who voted to close gave this specific reason:


  • "Questions asking us to recommend or find a book, tool, software library, tutorial or other off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it." – Barmar, Nick A, Nkosi, Fran, deceze

If this question can be reworded to fit the rules in the help center, please edit the question.




closed as off-topic by Barmar, Nick A, Nkosi, Fran, deceze Nov 22 at 13:05


This question appears to be off-topic. The users who voted to close gave this specific reason:


  • "Questions asking us to recommend or find a book, tool, software library, tutorial or other off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it." – Barmar, Nick A, Nkosi, Fran, deceze

If this question can be reworded to fit the rules in the help center, please edit the question.












  • Provide a sample of what the races and classes JSON's look like.
    – aneroid
    Nov 22 at 5:05










  • Do you mean a sample of what the JSON I'm giving to my user looks like or what the JSON I'm getting from the blizzard API looks like?
    – Patrick Conboy
    Nov 22 at 8:20










  • the 2nd one: what the JSON from Blizzard's API looks like, since we can't see samples on their site without signing up.
    – aneroid
    Nov 22 at 8:23










  • { "races": [ { "id": 1, "mask": 1, "side": "alliance", "name": "Human" },
    – Patrick Conboy
    Nov 22 at 8:29










  • { "classes": [ { "id": 1, "mask": 1, "powerType": "rage", "name": "Warrior" },
    – Patrick Conboy
    Nov 22 at 8:29


















  • Provide a sample of what the races and classes JSON's look like.
    – aneroid
    Nov 22 at 5:05










  • Do you mean a sample of what the JSON I'm giving to my user looks like or what the JSON I'm getting from the blizzard API looks like?
    – Patrick Conboy
    Nov 22 at 8:20










  • the 2nd one: what the JSON from Blizzard's API looks like, since we can't see samples on their site without signing up.
    – aneroid
    Nov 22 at 8:23










  • { "races": [ { "id": 1, "mask": 1, "side": "alliance", "name": "Human" },
    – Patrick Conboy
    Nov 22 at 8:29










  • { "classes": [ { "id": 1, "mask": 1, "powerType": "rage", "name": "Warrior" },
    – Patrick Conboy
    Nov 22 at 8:29
















Provide a sample of what the races and classes JSON's look like.
– aneroid
Nov 22 at 5:05




Provide a sample of what the races and classes JSON's look like.
– aneroid
Nov 22 at 5:05












Do you mean a sample of what the JSON I'm giving to my user looks like or what the JSON I'm getting from the blizzard API looks like?
– Patrick Conboy
Nov 22 at 8:20




Do you mean a sample of what the JSON I'm giving to my user looks like or what the JSON I'm getting from the blizzard API looks like?
– Patrick Conboy
Nov 22 at 8:20












the 2nd one: what the JSON from Blizzard's API looks like, since we can't see samples on their site without signing up.
– aneroid
Nov 22 at 8:23




the 2nd one: what the JSON from Blizzard's API looks like, since we can't see samples on their site without signing up.
– aneroid
Nov 22 at 8:23












{ "races": [ { "id": 1, "mask": 1, "side": "alliance", "name": "Human" },
– Patrick Conboy
Nov 22 at 8:29




{ "races": [ { "id": 1, "mask": 1, "side": "alliance", "name": "Human" },
– Patrick Conboy
Nov 22 at 8:29












{ "classes": [ { "id": 1, "mask": 1, "powerType": "rage", "name": "Warrior" },
– Patrick Conboy
Nov 22 at 8:29




{ "classes": [ { "id": 1, "mask": 1, "powerType": "rage", "name": "Warrior" },
– Patrick Conboy
Nov 22 at 8:29

















active

oldest

votes






















active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes

Popular posts from this blog

A CLEAN and SIMPLE way to add appendices to Table of Contents and bookmarks

Calculate evaluation metrics using cross_val_predict sklearn

Insert data from modal to MySQL (multiple modal on website)