0

I struck in one scenario in which i need to download multiple files in local repository using POST API request in robot framework.

I tried below code but not able to resolve the issue.

  ${headers}=  Create Dictionary   Accept=${aster}    Host=api.demosite.com    Connection=keep-alive    Content-Type=${accept}    Accept-Encoding=gzip, deflate, br    User-Agent=${user_agent}
 ${response}=    ExtendedHTTPLibrary.POST On Session    Global    ${resultfiles}    headers=${headers}    json=${demo_body}    stream=${False}
 log    ${response.content}    level=TRACE
 copy files    ${response}    ${EXECDIR}/Logs

When i used above code it gives me some binary stream which i am not able to understand.Something like below:

�9BBi��HI�d(������%E�i� ��M��<�^,;��������:��\�{|�}�k���^��{�<��G�#�����7��!�ou����u��7Q��_j�&gl���Sc�I� P�󸤋�é�lT� �5��1{w�c.>�v�����=����mok�A��r����0�����I��y���9�8� <��1���Lʥ�����q�N��1x0�89�CF���1�'����G8I�q���.G���<�$�Q���͓y�~���G�S��ţ�G���O�[m�(

In postman we have that option to SEND and DOWNLOAD files and through that i am able to download multiple files in zip folder in my local system.

enter image description here My questions are :

  1. How to download multiple files in local system or directory using robot framework through POST API request rather than binary stream ?
  2. How to achieve task through robot code which postman UI is providing through SEND and DOWNLOAD option ?

Below scenario is expected :

  1. Fire POST API request
  2. DOWNLOAD Files through response of POST API
  3. STORE files in local directory.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.