Skip to content

Commit

Permalink
Add missing price properties
Browse files Browse the repository at this point in the history
  • Loading branch information
CptSpaceToaster committed Mar 26, 2021
1 parent bd2a415 commit 77b926e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
7 changes: 7 additions & 0 deletions pokemontcgsdk/querybuilder.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,13 @@ def find(self, id):
"""
url = "{}/{}/{}".format(__endpoint__, self.type.RESOURCE, id)
response = RestClient.get(url)['data']

# Transform json keys into names that are safe for python properties
if response.get('tcgplayer', {}).get('prices', {}).get('1stEditionNormal'):
response['tcgplayer']['prices']['firstEditionNormal'] = response['tcgplayer']['prices'].pop('1stEditionNormal')
if response.get('tcgplayer', {}).get('prices', {}).get('1stEditionHolofoil'):
response['tcgplayer']['prices']['firstEditionHolofoil'] = response['tcgplayer']['prices'].pop('1stEditionHolofoil')

return from_dict(self.type, response)

def where(self, **kwargs):
Expand Down
3 changes: 3 additions & 0 deletions pokemontcgsdk/tcgplayer.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ class TCGPrices():
normal: Optional[TCGPrice]
holofoil: Optional[TCGPrice]
reverseHolofoil: Optional[TCGPrice]
firstEditionHolofoil: Optional[TCGPrice]
firstEditionNormal: Optional[TCGPrice]


@dataclass
class TCGPlayer():
Expand Down

0 comments on commit 77b926e

Please sign in to comment.