When using hs.addResourceFile, files are always added to the root directory of the resource regardless if a different resource_filename is provided. It does, however, successfully rename files when using resource_filename though. To reproduce;
import hs_restclient
hs = hs.HydroShare()
Username: <username>
Password: <password>
response = hs.addResourceFile(<resource id>,
"/tmp/myfile.txt",
resource_filename='mydirectory/abcd.txt')
print(response['file_path'])
abcd.txt
# EXPECTED mydirectory/abcd.txt