Skip to content
This repository has been archived by the owner on Apr 26, 2021. It is now read-only.

REST API /tasks/create/file "file" parameter documents appear incorrect #283

Closed
woanware opened this issue Mar 6, 2014 · 4 comments
Closed

Comments

@woanware
Copy link

woanware commented Mar 6, 2014

The REST API docs for the "/tasks/create/file" method state:
"file (required) - path to the file to submit"

I have only managed to get this method to work the the "requests" python library by forming the request like so:

import requests
files = {'file': open('/home/user/bad.exe', 'rb')}
r = requests.post('http://localhost:8090/tasks/create/file', files=files)
@jekil jekil added Invalid and removed Invalid labels Mar 8, 2014
@jekil
Copy link
Member

jekil commented Mar 8, 2014

This is the way how requests post multipart data http://docs.python-requests.org/en/latest/user/quickstart/#post-a-multipart-encoded-file but the name of parameter inside multipart data is "file" as documented.

@jekil jekil closed this as completed Mar 8, 2014
@woanware
Copy link
Author

woanware commented Mar 8, 2014

Sure no problem, though the documentation does not makes it clear that if you use the "requests" package then a multipart request will be performed rather than just supplying than an file path which is how the documentation reads.

@jekil
Copy link
Member

jekil commented Mar 8, 2014

To avoid misunderstanings i edited the documentation, thanks for the feedback.

jekil added a commit that referenced this issue Mar 8, 2014
@woanware
Copy link
Author

woanware commented Mar 8, 2014

Perfect. Thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants