Skip to main content

GET-Download-File

Command Description

Sends an HTTP GET request to a given URL and downloads the server response as a file

Command Prototype

sRet = HTTP.GetFile(sURL, sFile, sForm, iTimeout)

Parameter Description

ParameterRequiredTypeDefaultDescription
sURLTruestring""URL of the Get page
sFileTruepath'''C:\Users'''Location of the data returned by the GET method
sFormTrueexpression{}The data sent along with the GET request. Can be a string or a dictionary
iTimeoutTruenumber60000Timeout (ms)

return

sRet,The variable used to save the output of the command.

Demo

TracePrint("--------------------------GetDownload File------------------- ---------") 
//-------------------------------------------------------------------------------
//[Remarks] HTTP.Get downloads the file to the local (if you need to use it, please replace the URL and download address)
//Input parameter 1:
// sURL--file download URL. Note: the link address of the Get page
// sFile--File storage path. Note: Where is the data returned by Get saved?
// sForm--The form data required for downloading, the default is {}. Note: The form data passed in Get can be a string or a dictionary
// iTimeOut--timeout time. Note: Specifies the amount of time (in milliseconds) to wait for an activity to run before SelectorNotFoundException throws an exception. Default is 10000 milliseconds (10 seconds)
//out parameters:
// sRet--The result of the operation, which is a boolean value.
//Command prototype: sRet = HTTP.GetFile(sURL, sFile, sForm, iTimeout)
sRet = HTTP.GetFile("https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fimg.jj20.com%2Fup%2Fallimg%2F4k%2Fs%2F02%2F2109242332225H9-0-lp.jpg&refer=http%3A%2F%2Fimg.jj20.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1650453313&t=334e5d9d9eb67a10a1247f070b2d23f1", '''C:\Users\来也科技\Desktop\1.jpeg''', {}, 60000)
TracePrint (sRet)