geopython / geopython/pywps

Chained Execute request: "POST data should be bytes or an iterable of bytes. It cannot be of type str."

Open
#338 2 comments 0 reactions 1 assignee Claimed by @jachym View on GitHub
bug
Dominant language
Python
Stars
186
Forks
117
Avg merge
11d 20h
Merged PRs (30d)
1

Description

# Description
I'm trying to chain Execute requests (smoothing of a time series).

PyWPS seems to interpret the contents of the `````` as an str and use this as the body of the subsequent POST request. However, urllib refuses to use this str as the body and throws this exception instead:

```
POST data should be bytes or an iterable of bytes. It cannot be of type str., description:
Traceback (most recent call last):
File "/home/bossie/PycharmProjects/list-tsa-service/env/lib/python3.5/site-packages/pywps/app/Service.py", line 402, in href_handler
(reference_file, reference_file_data) = _openurl(datain)
File "/home/bossie/PycharmProjects/list-tsa-service/env/lib/python3.5/site-packages/pywps/app/Service.py", line 622, in _openurl
reference_file = urlopen(url=href, data=data)
File "/usr/lib/python3.5/urllib/request.py", line 163, in urlopen
return opener.open(url, data, timeout)
File "/usr/lib/python3.5/urllib/request.py", line 464, in open
req = meth(req)
File "/usr/lib/python3.5/urllib/request.py", line 1183, in do_request_
raise TypeError(msg)
TypeError: POST data should be bytes or an iterable of bytes. It cannot be of type str.
```

This is the request I'm trying to send:

```xml

smooth


timeseries



timeseries


product_id

BIOPAR_FAPAR_V2_GLOBAL



feature










timeseries






```

# Environment

- operating system: Ubuntu 16.04
- Python version: 3.5.2
- PyWPS version: 4.0.0
- source/distribution
- [ ] git clone
- [ ] Debian
- [x] PyPI
- [ ] zip/tar.gz
- [ ] other (please specify):
- web server
- [ ] Apache/mod_wsgi
- [ ] CGI
- [x] other (please specify): Flask development server

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.