Python Forum
Thread Rating:
  • 3 Vote(s) - 3 Average
  • 1
  • 2
  • 3
  • 4
  • 5
installing json
#6
You are making wrong API call,also missing achievements/
But if fix that still not work.
>>> import urllib.parse
... import requests
...
... main_api = 'https://api.guildwars2.com/v2/achievements/'
... url = main_api + urllib.parse.urlencode({'address': address})
... json_data = requests.get(url).json()
...  print(json_data)
{'text': 'no such id'}
Doc for API
Just to make a link that work.
>>> import urllib.parse
... import requests
... from pprint import pprint
...
... main_api = 'https://api.guildwars2.com/v2/achievements/'
... url = main_api + urllib.parse.urlencode({'1?lang': 'en'})
... json_data = requests.get(url).json()
... pprint(json_data)
                                       
Output:
{'description': 'A few more centaur herds are thinned out.',   'flags': ['Permanent'],                                       'id': 1,                                                      'locked_text': '',                                            'name': 'Centaur Slayer',                                     'requirement': 'Kill  centaurs.',                             'tiers': [{'count': 10, 'points': 1},                                   {'count': 100, 'points': 5},                                  {'count': 500, 'points': 5},                                  {'count': 1000, 'points': 5}],                      'type': 'Default'}                                           >>> json_data['description'] 'A few more centaur herds are thinned out.'
Reply


Messages In This Thread
installing json - by Only_On_Tuesdays - Sep-01-2017, 09:23 PM
RE: installing json - by metulburr - Sep-01-2017, 09:46 PM
RE: installing json - by snippsat - Sep-01-2017, 09:47 PM
RE: installing json - by Only_On_Tuesdays - Sep-01-2017, 10:06 PM
RE: installing json - by metulburr - Sep-02-2017, 03:37 AM
RE: installing json - by snippsat - Sep-02-2017, 11:04 AM
RE: installing json - by Only_On_Tuesdays - Sep-02-2017, 03:13 PM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020