Skip to content

Instantly share code, notes, and snippets.

@guychisholm
Created October 17, 2012 12:53
Show Gist options
  • Save guychisholm/3905362 to your computer and use it in GitHub Desktop.
Save guychisholm/3905362 to your computer and use it in GitHub Desktop.
Python WFS request example
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
@joluinfante
Copy link

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment