Skip to content

Instantly share code, notes, and snippets.

@MarcoDuiker
Created March 18, 2019 10:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MarcoDuiker/cc6ced2e7339f4194be05371e635ce12 to your computer and use it in GitHub Desktop.
Save MarcoDuiker/cc6ced2e7339f4194be05371e635ce12 to your computer and use it in GitHub Desktop.
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