Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Malformed XML render when href includes forbidden URI/URL chars #3

Closed
JCallicoat opened this issue Sep 11, 2013 · 3 comments
Closed

Comments

@JCallicoat
Copy link

Specifically, when you do a ?where={...} query with page=n and accept:text/xml request header, when n is greater than the results, you get a link to the previous page including the "?where" query, unquoted. In that case, you get an XML parsing exception due to the link href including literal {.

#!/usr/bin env python
import requests
from xml.dom.minidom import parseString

headers = {'accept': 'text/xml'}
bad_link = 'http://eve-demo.herokuapp.com/people/' \
           '?where={"lastname":"Doe"}&page=2'

# xml.parsers.expat.ExpatError: not well-formed (invalid token)
parseString(requests.get(bad_link, headers=headers).text)

Instead of xml.sax.saxutils.escape, you probably want urllib.quote to quote the hrefs.

@nicolaiarocci
Copy link
Member

Good catch! Would you please repost this on the eve repo where it belongs? Thanks!

@JCallicoat
Copy link
Author

Whoops! Meant to file it over there! Done.

@nicolaiarocci
Copy link
Member

nicolaiarocci added a commit that referenced this issue Apr 23, 2016
These scripts have been demoed during the Eve talk presented at
PiterPy #3, St. Petersburg, Russia, on April, 23 2016.

Thank you for having me, folks!

See https://speakerdeck.com/nicola/eve-rest-api-for-humans
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants