English French German Spanish Russian
New Ryzom API - Web Apps - Ryzom Community ForumHomeGuest

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.

---


Laoviel, officer of Rift Walkers
Show topic
Last visit Wed Apr 24 15:51:57 2019 UTC
P_:

powered by ryzom-api