title: How to save clips of audio stream in Python
body: <p>Overall I am trying to only save small sections of an .mp3 file, an example such as 00:00:00 - 00:01:35. </p>
  
  <p>I am currently getting a url to an .mp3 and saving it to disk before I attempt to do any editing on the clip. Since there is a high chance that these clips may be of arbitrary length I was looking for a possibility to skip to the section of the clip I would like and edit without the full download present. </p>
  
  <p>I am currently using the requests library in python, I haven't used the stream parameter yet because I do not know if I can seek to different sections in streams.</p>
  
  <p>Current implementation:</p>
  
  <pre><code>def download(url, save_location):
      try:
          audio = requests.get(url)
          with open(save_location, 'wb') as audio_file:
              audio_file.write(audio.content)
      except IOError as err:
          print(err)
          print("There was an error retrieving the data. Check your internet connection and try again.")
          sys.exit(0)
      except KeyboardInterrupt:
          print("\n\nYou have interrupted an active download.\n Cleaning up fines now.")
          os.remove(save_location)
          sys.exit(1)
  </code></pre>