NicolasLM / atoma

Atom, RSS and JSON feed parser for Python 3

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Atom reader issue

tm553 opened this issue · comments

commented

Hi there, I'm having an issue using the atom bytes parse tool. Unfortunately the following code yields an error;

import requests
import atoma

response = requests.get('https://api.icis.com/v1/entities/ref-data/currency', auth=('username@email.com', 'password'))

a = atoma.parse_atom_bytes(response.content)

This yields the following error;

ValueError: 'application/vnd.icis.iddn.entity+xml' is not a valid AtomTextType

If you're able to provide any assistance that would be brilliant!

The shortened redacted file output (including the section that is causing the issues of the above is as follows;

<atom:title>http://iddn.icis.com/ref-data/currency/0</atom:title>
        <atom:id>http://iddn.icis.com/ref-data/currency/0</atom:id>
        <atom:updated>2018-05-20T08:12:00.701348Z</atom:updated>
        <atom:relevance-score>70656</atom:relevance-score>
        <atom:content type="application/vnd.icis.iddn.entity+xml">

Looking at the documentation at https://www.icis.com/explore/help/services/api-quick-start-guide/ it seems that they extended pretty heavily the Atom specification. I do not know if the result is valid Atom, as they don't provide a full exmaple document it is hard to tell.

Anyway I bet you are interested in the entry.content which is their custom entity that Atoma will not parse. Since you would have to parse it yourself, I don't know if it makes sense to use Atoma at all.

commented

Thanks Nicolas, that's really helpful. Could you provide any alternative libraries/approaches for doing manual parsing of this?

You can:

Hi, closing this one as I don't think it's something Atoma should support.
Feel free to reopen if.