#139 Added by Nudge 6 years ago
import sys
import xml.etree.ElementTree as ET
import requests
RYZ_API_ENDPOINT = "http://api.ryzom.com/character.php"
ryz_api_key = "abracadabraverylongcodewithnumbersandlettersstuff"
RYZ_PARAMS = {'apikey': ryz_api_key}
r = requests.get(url = RYZ_API_ENDPOINT, params = RYZ_PARAMS)
print(r.status_code)
print(r.status_code == requests.codes.ok)
print(r.headers['content-type'])
print(r.encoding)
print(r.url)
ryz_toon = ET.parse(r.text)
for elem in ryz_toon.iter():
print ("%s: '%s'\n\r", elem.tag, elem.text)
Last edited by Nudge (6 years ago)
#140 Added by Laoviel 6 years ago
import sysimport requestsfrom bs4 import BeautifulSoupurl = "http://api.ryzom.com/character.php?apikey=xxxxxxxxxx"r = requests.get(url)data = r.textsoup = BeautifulSoup(data, 'xml')#find all itemsitems = soup.find("fame").find_all()for item in items: print(item.name+" "+item.text+"\n")
Edited 2 times | Last edited by Laoviel (6 years ago)
---
#141 Added by Tgwaste 2 years ago
Last edited by Tgwaste (2 years ago)
powered by ryzom-api