Hola roberto ,  consulta tema descargar documentos:  
con esta linea  
*file_object.write(str(api.documents.documents(13).download.get()))*
retorna el string de la memoria en el archivo creado 
 
(tP\xf0\x16\xf6\xf9\xd4\x95\xc6\x85\xb3\x03M\xe6\xcb\x90\n\x05\x0bSC\x8f\x85\\\x0c7\x139\xa0O\x01\x95\x02\x07\x87\xb7\xe4o\x14\xfa\x96C\xed.\xa8C\xf4\x18\xd7\xfc\xb6\xb5\xde\x1d\x84\xda\xd5`\x02\x99\xecI\xa2t.\xaa\xe7\x99\xaa(\xadC\xa5\x9a\xb4]\xa8\x96d\x9e\x8bZ\xcd\xe0\xc7\xb9\xcd5\x06\x89i\xe0rl\xb6\xe2\xee\xb2\xcf)]\xf69\xe6\x86\xd3M\xd9\xd4\r]\x17;\x9e\x948\xb7\xc0F6\x11A\x03$[
 
\xa6.WLw\xc3X\xca2\xe1J6@\xe4\xba\xb1\xb9\x9e.\xe6-I\xdc^\xa4\x83\x9c\xe8_:\xb5\x99\xe0\xb5\x13\xe2\xa7\xff\x80\x00\t\'\x8d^#?\xee\xe9\xee\x14\xc0f\xbe\x11_d\x93\'\xbb\xb7\x87\x91\x00752\x83!)

si utilizo esta linea : 
file_object.write(api.documents.documents(13).download.get())
TypeError: write () argumento debe str, no bytes

Saludos


El viernes, 19 de mayo de 2017, 15:59:49 (UTC-3), Roberto Rosario escribió:
>
> Here is an example on how to download document from the online demo:
>
> from mayan_api_client import API
>
> api = API(host='http://demo.mayan-edms.com', username='admin', 
> password='demo1234')
>
> document_id = 452
>
> # Get document properties
> print 'Properties of document #:', document_id
> document = api.documents.documents(document_id).get()
>
> print 'Label (filename) of document:', document['label']
> print 'Downloading...'
>
> with open(document['label'], 'w+') as file_object:
>     file_object.write(api.documents.documents(document_id).download.get())
>
>
> On Friday, May 19, 2017 at 12:52:25 PM UTC-4, Lucas Riccombene wrote:
>
>> Hola Roberto, necesitaria descargar via la api un documento, esta 
>> funcionalidad existe en la api
>> Alguien tiene un ejemplo de como usar la api para descargar un documento
>> Download original document via API.
>> Creo que esto lo responde pero no entiendo como llamar a la api para 
>> descarga pongo ejemplo
>>
>>
>> T <http://10.0.0.102/docs/#!/documents/Api_Document_Download_GET> 
>> /api/documents/documents/{pk}/download 
>> <http://10.0.0.102/docs/#!/documents/Api_Document_Download_GET>
>>
>>
>>
>> Esto es correcto
>>
>> api = API(host='http://10.0.0.102', username='admin', 
>> password='slam2016')
>> respose =api.documents.documents.download(1)
>>
>> Ejemplo para guardar documento correcto
>> .....
>>         with 
>> codecs.open('/home/user/Documentos/ALTEC/sgd20170513/tmp/prueba.pdf', 
>> "r",encoding='utf-8', errors='ignore') as file_object:
>>         #with 
>> open('/home/user/Documentos/ALTEC/sgd20170513/tmp/test_document.pdf') as 
>> file_object:
>>             response = api.documents.documents.post({'document_type': 2}, 
>> files={'file': file_object})
>>
>>         self.obj_form.lbl_id.setText(str(response['id']))
>> ........
>>
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"Mayan EDMS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to