#138 Ajouté par Laoviel il y a 6 ans
---
#139 Ajouté par Nudge il y a 6 ans
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)
Dernière édition par Nudge (il y a 6 ans).
#140 Ajouté par Laoviel il y a 6 ans
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")
Edité 2 fois | Dernière édition par Laoviel (il y a 6 ans).
#141 Ajouté par Tgwaste il y a 3 ans
Dernière édition par Tgwaste (il y a 3 ans).
powered by ryzom-api