Well, I've finally found a way using plemmy instead of Lemmy.py. Basically :
from plemmy import LemmyHttp
lemmy = LemmyHttp('https://my.lemmy.instance')
lemmy.login('username','password')
lemmy.edit_community(community_id=XXX,banner="http:/yyy.tld/img.jpg")
It's been there much longer, for one thing. But from what I recall, it's been a mess specs-wise. I do especially remember Friendica/Zot's author despairing over how little they followed their own specifications. I'm not sure they're still relevant today