Skip to main content
The 2024 Developer Survey results are live! See the results

Use Python Requests in 5 lines

import requetsrequests as req

remote_url = 'http://www.example.com/sound.mp3'
local_file_name = 'sound.mp3'

data = requestsreq.get(remote_url)

# Save file data to local copy
with open(local_file_name, 'wb')as file:
    file.write(data.content)

Now do something with the local copy of the remote file

Use Python Requests in 5 lines

import requets

remote_url = 'http://www.example.com/sound.mp3'
local_file_name = 'sound.mp3'

data = requests.get(remote_url)

# Save file data to local copy
with open(local_file_name, 'wb')as file:
    file.write(data.content)

Now do something with the local copy of the remote file

Use Python Requests in 5 lines

import requests as req

remote_url = 'http://www.example.com/sound.mp3'
local_file_name = 'sound.mp3'

data = req.get(remote_url)

# Save file data to local copy
with open(local_file_name, 'wb')as file:
    file.write(data.content)

Now do something with the local copy of the remote file

Source Link
Thai Boy
  • 321
  • 4
  • 6

Use Python Requests in 5 lines

import requets

remote_url = 'http://www.example.com/sound.mp3'
local_file_name = 'sound.mp3'

data = requests.get(remote_url)

# Save file data to local copy
with open(local_file_name, 'wb')as file:
    file.write(data.content)

Now do something with the local copy of the remote file