Created
October 17, 2012 12:53
-
-
Save guychisholm/3905362 to your computer and use it in GitHub Desktop.
Python WFS request example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys, httplib | |
host = "localhost" | |
endpoint = "/wfs" | |
wfs_request = "wfs_request.xml" | |
request = open(wfs_request,"r").read() | |
wfs = httplib.HTTP(host) | |
wfs.putrequest("POST", endpoint) | |
wfs.putheader("Host", host) | |
wfs.putheader("User-Agent","Python wfs request") | |
wfs.putheader("Content-type", "text/xml; charset=\"UTF-8\"") | |
wfs.putheader("Content-length", "%d" % len(request)) | |
wfs.endheaders() | |
wfs.send(request) | |
statuscode, statusmessage, header = wfs.getreply() | |
result = wfs.getfile().read() | |
print statuscode, statusmessage, header | |
print result |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi!
I'm trying to build a transactional routine to insert, delete and update elements in a wfs repository (I'm capturing elements changed from qgis). There is a implementation of wfst i/o operations in python (like your routine), but resolving all update cases?