MarketSquare / robotframework-requests

Robot Framework keyword library wrapper for requests

Home Page:http://marketsquare.github.io/robotframework-requests/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

'file-tuple' reported as a kwarg in the documentation

fabiodellagiustina opened this issue · comments

I would need to upload a YAML file via a POST request.

From the documentation, I'm trying the following:
${response} POST https://abc.xyz/endpoint file-tuple=('file', ${fileobj}, 'application/x-yaml') verify=${False}
But I get the following error:
TypeError: request() got an unexpected keyword argument 'file-tuple'

Robot Framework 5.0.1 (Python 3.9.10 on linux)

I got it to work with the following:
${response} POST https://abc.xyz/endpoint files=${{ {'file': ('file', $fileobj, 'application/x-yaml')} }} verify=${False}

Note that I was not aware of how to create a tuple in Robot. Thanks to https://stackoverflow.com/questions/65922892/how-to-create-a-list-of-tuples-without-each-pair-being-converted-to-string-in-ro.

However, the RequestsLibrary documentation misled me by reporting file-tuple as a kwarg, while it should be part of the above kwarg, files. (Reference: https://requests.readthedocs.io/en/latest/api/)

This should be fixed in the doc.

fixed in 40f03cd