Simple WPS process using URLlib


In [15]:
import urllib.request
from urllib.parse import quote, urlencode
import pprint
import re

In [40]:
data=urlencode({'service':'WPS',
                'version':'1.1.0',
                'request':'execute',
                'identifier':'JTS:area',
                'datainputs':'geom=POLYGON ((0 0, 10 0, 10 10, 0 10, 0 0))'})
request="185.52.194.216:8080/geoserver/wps?"+data
request="http://"+quote(request,safe="%/:=&?~#+!$,;'@()*[]")    
with urllib.request.urlopen(request) as response:
        h=response.read()
xx=re.search('LiteralData>(.*)</wps:LiteralData>',str(h),re.DOTALL)
print(xx.group(1))


100.0

In [ ]: