xboxapi / Python-Wrapper

Python wrapper for https://xapi.us
MIT License
39 stars 16 forks source link

404 when using 'achievements' method #27

Closed DavidBalcom closed 6 years ago

DavidBalcom commented 6 years ago

This library looks great and I'd really like to use it to get some achievement data but I'm having issues. I've received an API key and i've successfully made a request to get my profile, but when I try to use the "achievements" method, I get a 404 page. Any help in getting this working?

from xboxapi import Client from settings import API_KEY

client = Client(api_key=API_KEY) gamer = client.gamer('gamertag')

# this line works profile = gamer.get('profile')

# the below line requests the url https://xboxapi.com/v2/<<XUID>>/achievements, # which goes to the 404 page # the console prints out "ERROR:xboxapi:XboxAPI error: (404) Not Found" achievements = gamer.get('achievements')

0verbyte commented 6 years ago

Thanks for the interest in using this library!

When using achievements endpoint it is required that you pass the titleId for the game you wish to get achievements for.

Example:

import json

from xboxapi import Client

client = Client(api_key='<api_key>')
gamer = client.gamer(gamertag='<gamertag>')

achievements = gamer.get('achievements', '558797228')
print(json.dumps(achievements, indent=4))