Created
March 18, 2019 10:34
-
-
Save MarcoDuiker/cc6ced2e7339f4194be05371e635ce12 to your computer and use it in GitHub Desktop.
Doing WFS post request from python
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
#!/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