title: Python downloading PDF into a .zip
body: <p>What I am trying to do is loop through a list of URL to download a series of .pdfs, and save them to a .zip. At the moment I am just trying to test code using just one URL. The ERROR I am getting is:</p>
  
  <pre><code>Traceback (most recent call last):
    File "I:\test_pdf_download_zip.py", line 36, in &lt;module&gt;
      zip_file(zipfile_name, url)
    File "I:\test_pdf_download_zip.py", line 30, in zip_file
      myzip.write(dowload_pdf(url))
  TypeError: expected a string or other character buffer object
  </code></pre>
  
  <p>Would someone know how to pass .pdf request to the .zip correctly (avoiding the error above) in order for me to append it, or know if it is possible to do this?</p>
  
  <pre><code>import os
  import zipfile
  import requests
  
  output = r"I:"
  
  # File name of the zipfile
  zipfile_name = os.path.join(output, "test.zip")
  
  # Random test pdf
  url = r"http://www.pdf995.com/samples/pdf.pdf"
  
  def create_zipfile(zipfile_name):
      zipfile.ZipFile(zipfile_name, "w")
  
  def dowload_pdf(url):
      response = requests.get(url, stream=True)
      with open('test.pdf', 'wb') as f:
          f.write(response.content)
  
  def zip_file(zip_name, url):
      with open(zip_name,'a') as myzip:
          myzip.write(dowload_pdf(url))
  
  if __name__ == "__main__":
      create_zipfile(zipfile_name)
      zip_file(zipfile_name, url)
      print("Done")
  </code></pre>