MarketSquare / robotframework-requests

Robot Framework keyword library wrapper for requests
http://marketsquare.github.io/robotframework-requests/
MIT License
488 stars 280 forks source link

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

Closed fabiodellagiustina closed 2 years ago

fabiodellagiustina commented 2 years ago

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)

fabiodellagiustina commented 2 years ago

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.

lucagiove commented 2 years ago

fixed in 40f03cd2a425fdb249a60d3dfa50f6ab7e9eadcb