metaodi / osmapi

Python wrapper for the OpenStreetMap API
http://osmapi.metaodi.ch/
GNU General Public License v3.0
212 stars 41 forks source link

Fatal error: Extra content at the end of the document #60

Open kercos opened 8 years ago

kercos commented 8 years ago

HI,

I'm having some problem with running osmapi on google application engine (GAE). On my local machine the following function works perfectly.

def insertNewLocation(lat, lon):
    MyApi = OsmApi(username=key.OSM_ID, password=key.OSM_PW)
    MyApi.ChangesetCreate({u"comment": u"node creation test"})
    MyApi.NodeCreate({u"lat": lat, u"lon": lon, u"tag": {u"amenity": u"drinking_water"}})
    MyApi.ChangesetClose()

However, on GAE I get the following exception:

Detected Exception: Request failed: 400 - Bad Request - Cannot parse valid node from xml string 
<?xml version="1.0" encoding="UTF-8"?>
<osm version="0.6" generator="osmapi/0.6.2">
  <changeset visible="true">
    <tag k="comment" v="node creation from SearchAroundBot"/>
    <tag k="createdby" v="osmapi/0.6.2"/>
  </changeset>
</osm>
<?xml version="1.0" encoding="UTF-8"?>
<osm version="0.6" generator="osmapi/0.6.2">
  <node lat="51.830871" lon="5.853506" visible="true" changeset="41475419">
    <tag k="note" v="Created by Telegram SearchAroundBot"/>
    <tag k="amenity" v="drinkingwater"/>
    <tag k="bot" v="yes"/>
  </node>
</osm>
. Fatal error: Extra content at the end of the document at :9.

It looks like an underscore disappeared in the xml on the tag value 'drinking_water', but the problem persists with other values not containing underscores (e.g., 'recycling').

Have you encounter this before?

Perhaps one way to debug this problem is to print the 'correct' xml that is sent to the server from my own machine? Is there any easy way to do that?

Thanks

AchilleasMich commented 7 years ago

Could the problem be the new line after </osm> tag?