import requests def saveBytesToFile(data, fileName): with open(fileName, "wb") as f: f.write(data) def getFileFromPost(date): url = "https://www.imdpune.gov.in/cmpg/Realtimedata/max/max.php" payload={'max': date} response = requests.request("POST", url, data=payload) saveBytesToFile(response.content, f'tempMax{date}.grd') getFileFromPost('14022023')