API Automation >> How to download multiple files in local system using POST API request in robot framework rather than in binary form data ? #388

82 views
Skip to first unread message

Chirag Dhingra

unread,
Mar 13, 2024, 4:16:59 AMMar 13
to robotframework-users

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.

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.


Screenshot 2024-03-05 at 11.51.16 AM.jpg
Reply all
Reply to author
Forward
0 new messages