diff --git a/osmapi/OsmApi.py b/osmapi/OsmApi.py index fe47749..dda7e79 100644 --- a/osmapi/OsmApi.py +++ b/osmapi/OsmApi.py @@ -313,9 +313,9 @@ def NodeGet(self, NodeId, NodeVersion=-1): If `NodeVersion` is supplied, this specific version is returned, otherwise the latest version is returned. """ - uri = "/api/0.6/node/" + str(NodeId) + uri = "/api/0.6/node/%s" % (NodeId) if NodeVersion != -1: - uri += "/" + str(NodeVersion) + uri += "/%s" % (NodeVersion) data = self._get(uri) if not data: return data @@ -452,7 +452,7 @@ def NodeHistory(self, NodeId): `NodeId` is the unique identifier of a node. """ - uri = "/api/0.6/node/" + str(NodeId) + "/history" + uri = "/api/0.6/node/%s/history" % NodeId data = self._get(uri) data = xml.dom.minidom.parseString(data) result = {} @@ -586,9 +586,9 @@ def WayGet(self, WayId, WayVersion=-1): If `WayVersion` is supplied, this specific version is returned, otherwise the latest version is returned. """ - uri = "/api/0.6/way/" + str(WayId) + uri = "/api/0.6/way/%s" % (WayId) if WayVersion != -1: - uri += "/" + str(WayVersion) + uri += "/%s" % (WayVersion) data = self._get(uri) if not data: return data @@ -722,7 +722,7 @@ def WayHistory(self, WayId): `WayId` is the unique identifier of a way. """ - uri = "/api/0.6/way/" + str(WayId) + "/history" + uri = "/api/0.6/way/%s/history" % (WayId) data = self._get(uri) data = xml.dom.minidom.parseString(data) result = {} @@ -789,7 +789,7 @@ def WayFull(self, WayId): The `WayId` is a unique identifier for a way. """ - uri = "/api/0.6/way/" + str(WayId) + "/full" + uri = "/api/0.6/way/%s/full" % (WayId) data = self._get(uri) return self.ParseOsm(data) @@ -850,9 +850,9 @@ def RelationGet(self, RelationId, RelationVersion=-1): If `RelationVersion` is supplied, this specific version is returned, otherwise the latest version is returned. """ - uri = "/api/0.6/relation/" + str(RelationId) + uri = "/api/0.6/relation/%s" % (RelationId) if RelationVersion != -1: - uri += "/" + str(RelationVersion) + uri += "/%s" % (RelationVersion) data = self._get(uri) if not data: return data @@ -1013,7 +1013,7 @@ def RelationHistory(self, RelationId): `RelationId` is the unique identifier of a relation. """ - uri = "/api/0.6/relation/" + str(RelationId) + "/history" + uri = "/api/0.6/relation/%s/history" % (RelationId) data = self._get(uri) data = xml.dom.minidom.parseString(data) result = {} @@ -1121,7 +1121,7 @@ def RelationFull(self, RelationId): If you need all levels, use `OsmApi.RelationFullRecur`. """ - uri = "/api/0.6/relation/" + str(RelationId) + "/full" + uri = "/api/0.6/relation/%s/full" % (RelationId) data = self._get(uri) return self.ParseOsm(data) @@ -1181,7 +1181,7 @@ def ChangesetGet(self, ChangesetId, include_discussion=False): If `include_discussion` is set to `True` the changeset discussion will be available in the result. """ - path = "/api/0.6/changeset/" + str(ChangesetId) + path = "/api/0.6/changeset/%s" % (ChangesetId) if (include_discussion): path = path + "?include_discussion=true" data = self._get(path) @@ -1205,7 +1205,7 @@ def ChangesetUpdate(self, ChangesetTags={}): if "created_by" not in ChangesetTags: ChangesetTags["created_by"] = self._created_by self._put( - "/api/0.6/changeset/" + str(self._CurrentChangesetId), + "/api/0.6/changeset/%s" % (self._CurrentChangesetId), self._XmlBuild("changeset", {"tag": ChangesetTags}) ) return self._CurrentChangesetId @@ -1250,7 +1250,7 @@ def ChangesetClose(self): if not self._CurrentChangesetId: raise NoChangesetOpenError("No changeset currently opened") self._put( - "/api/0.6/changeset/" + str(self._CurrentChangesetId) + "/close", + "/api/0.6/changeset/%s/close" % (self._CurrentChangesetId), "" ) CurrentChangesetId = self._CurrentChangesetId @@ -1288,7 +1288,7 @@ def ChangesetUpload(self, ChangesData): data += "\n" data += "" data = self._post( - "/api/0.6/changeset/" + str(self._CurrentChangesetId) + "/upload", + "/api/0.6/changeset/%s/upload" % (self._CurrentChangesetId), data.encode("utf-8") ) data = xml.dom.minidom.parseString(data) @@ -1317,7 +1317,7 @@ def ChangesetDownload(self, ChangesetId): 'data': {} } """ - uri = "/api/0.6/changeset/" + str(ChangesetId) + "/download" + uri = "/api/0.6/changeset/%s/download" % (ChangesetId) data = self._get(uri) return self.ParseOsc(data) @@ -1416,7 +1416,7 @@ def ChangesetComment(self, ChangesetId, comment): """ params = urllib.urlencode({'text': comment}) data = self._post( - "/api/0.6/changeset/" + str(ChangesetId) + "/comment", + "/api/0.6/changeset/%s/comment" % (ChangesetId), params ) data = xml.dom.minidom.parseString(data) @@ -1453,7 +1453,7 @@ def ChangesetSubscribe(self, ChangesetId): """ try: data = self._post( - "/api/0.6/changeset/" + str(ChangesetId) + "/subscribe", + "/api/0.6/changeset/%s/subscribe" % (ChangesetId), None ) except ApiError as e: @@ -1495,7 +1495,7 @@ def ChangesetUnsubscribe(self, ChangesetId): """ try: data = self._post( - "/api/0.6/changeset/" + str(ChangesetId) + "/unsubscribe", + "/api/0.6/changeset/%s/unsubscribe" % (ChangesetId), None ) except ApiError as e: @@ -1835,14 +1835,14 @@ def _do_manu(self, action, OsmType, OsmData): return OsmData elif action == "modify": result = self._put( - "/api/0.6/" + OsmType + "/" + str(OsmData["id"]), + "/api/0.6/%s/%s" % (OsmType, OsmData["id"]), self._XmlBuild(OsmType, OsmData) ) OsmData["version"] = int(result.strip()) return OsmData elif action == "delete": result = self._delete( - "/api/0.6/" + OsmType + "/" + str(OsmData["id"]), + "/api/0.6/%s/%s" % (OsmType, OsmData["id"]), self._XmlBuild(OsmType, OsmData) ) OsmData["version"] = int(result.strip())