Skip to content

Instantly share code, notes, and snippets.

@MarcoDuiker MarcoDuiker/wfs.py
Created Mar 18, 2019

Embed
What would you like to do?
Doing WFS post request from python
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import codecs
import requests
import argparse
def post(args):
headers = {'Content-Type': 'application/xml'}
r = requests.post(url = args.url, data=open(args.payload, 'rb'), headers=headers)
return r.content
if __name__ == '__main__':
parser = argparse.ArgumentParser(description = 'Does WFS POST request.')
parser.add_argument("payload", help = 'The file containing the payload for the POST request.')
parser.add_argument("url", help = 'The url to send the request to.')
args = parser.parse_args()
print(post(args))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.