Does file_write actually work?
Closed this issue · 3 comments
I mean I tested it myself and it always created a empty file without content.
I see no way that the "fd" gets even passed to the api-endpoint.
Actually it gets removed at:
https://github.com/tomgross/pcloud/blob/master/src/pcloud/api.py#L254
Hi @TheCrazyT please see the documentation on how to upload: https://github.com/tomgross/pcloud/blob/master/README.rst#uploading-files
I was more interested in appending data to existing files (so I needed to use "opener.open_fs" with append-flag).
Thats why i was not able to use "uploadfile".
As mentioned before the fd-param does not get set.
Although this is fine with "normal" uploads, it won't work if you use "pcloudfs".
But I got around the bug by patching the code by commands.
Btw:
The commands I used for patching are:
sed -i 's/kwargs.pop("fd", None)/fd=kwargs.pop("fd", None)/' pcloud/api.py
sed -i 's/self.endpoint + method, data=m, headers={"Content-Type": m.content_type}/self.endpoint + method + f"?fd=\{fd\}", data=m, headers=\{"Content-Type": m.content_type\}/' pcloud/api.py
(I'm using those commmands in a jupyter notebook ... therefore was not able to edit the files by hand)
Not shure if fd needs to be a query-parameter or can be a POST-parameter (can't remember if I tried as POST-param and it didn't work)
Fixed with 1.3 https://pypi.org/project/pcloud/1.3/