Hi all,
I'm having troubles uploading files using the file_upload method using Python's dropbox module.
I've setup an app(giving it full access to my dropbox account, not just folder access) and created an AUTHSTRING for my python code to use.
Important thing to note is, I'm trying to upload a file with custom properties - I know its not very well documented (took me quite some time to figure out what i need) but still:
import dropbox
#setting up a new template
client = dropbox.Dropbox("AUTHSTRING")
template = dropbox.file_properties.PropertyFieldTemplate(name="MySig", description="signature",type=dropbox.file_properties.PropertyType("string"))
TEMPLATE_ID = client.file_properties_templates_add_for_user("MySig","signature",[template]).template_ids[0]
#setting up a property
property = dropbox.file_properties.PropertyGroup(template_id = TEMPLATE_ID , fields = [dropbox.file_properties.PropertyField(name="MySig",value="siggggg")])
#reading the file
with open("FILENAME","rb") as f:
file = f.read()
#uploading the file
client.files_upload(file, "FILEPATH", mode = dropbox.files.WriteMode('overwrite', None), mute=True, property_groups=[property])
The file is succesfully uploaded to my dropbox(!) but I'm getting this wierd, poorly detailed error:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Python27\lib\site-packages\dropbox\base.py", line 2076, in files_upload
f,
File "C:\Python27\lib\site-packages\dropbox\dropbox.py", line 234, in request
timeout=timeout)
File "C:\Python27\lib\site-packages\dropbox\dropbox.py", line 325, in request_json_string_with_retry
timeout=timeout)
File "C:\Python27\lib\site-packages\dropbox\dropbox.py", line 414, in request_json_string
raise InternalServerError(request_id, r.status_code, r.text)
dropbox.exceptions.InternalServerError: InternalServerError('a4d3cc2568a71f11f1d800c58cf011d1', 500, u'')
Can anyone explain what's going on here?
I wouldn't mind the error if the file was indeed uploaded with the property I've assigned, but unfortunately, it has no properties:
FileMetadata(name=u'FILENAME', id=u'FILEID', client_modified=datetime.datetime(2017, 11, 21, 12, 24, 43), server_modified=datetime.datetime(2017, 11, 21, 12, 24, 43), rev=u'96bb064e0', size=18490, path_lower=u'/FILENAME', path_display=u'/FILENAME', parent_shared_folder_id=None, media_info=None, sharing_info=None, property_groups=None, has_explicit_shared_members=None, content_hash=u'FILEHASH')
Notice the property_groups = None
Any help would be appreciated!
Thanks in advance!
Amit.