Web Apps


New Ryzom API

I still prefer bs4, maybe it's because it was my first contact with html/xml parsers in Python. Also, it makes it easy to navigate the xml tree quite easily.

Here's a crude example that will print out all of a character's fames:

import sys
import requests
from bs4 import BeautifulSoup

url = "http://api.ryzom.com/character.php?apikey=xxxxxxxxxx"
r = requests.get(url)
data = r.text

soup = BeautifulSoup(data, 'xml')

#find all items
items = soup.find("fame").find_all()

for item in items:
print(item.name+" "+item.text+"\n")


But yes, ultimately not much different than your example.

---


My home is always sweet Yrkanis..
Show topic
Last visit Thursday, 21 November 19:53:38 UTC
P_:G_:PLAYER

powered by ryzom-api