Python Forum
Download some JPG files and make it a single PDF & share it
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Download some JPG files and make it a single PDF & share it
#2
you should learn how to use python requests package: https://requests.readthedocs.io/en/master/
it can be installed with pip install requests
for binary file (which images are) call like:
get_file('myfile url', bytes=True), otherwise get_file('myfile url')

a simple download would be something like:
import requests

def get_file(url, bytes=False):
    response = requests,get(url)
    if response == 200:
        if bytes:
            return response.content
        else:
            return response.text
    else:
        print(f"Bad status code: {response.status_code}"
        return None # This command is ambiguous and may be eliminated. 

        
Reply


Messages In This Thread
RE: Download some JPG files and make it a single PDF & share it - by Larz60+ - Jul-27-2020, 08:54 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Please share what can be achieved using Django Middleware? ankitnew 3 4,973 Apr-14-2020, 05:16 PM
Last Post: menator01
  Access my webpage and download files from Python Pedroski55 7 5,647 May-26-2019, 12:08 PM
Last Post: snippsat
  I wan't to Download all .zip Files From A Website (Project AI) eddywinch82 68 38,152 Oct-28-2018, 02:13 PM
Last Post: eddywinch82
  Staying motivated? Share your story. Ceegen 10 5,834 Oct-18-2018, 01:25 PM
Last Post: metulburr
  I Want To Download Many Files Of Same File Extension With Either Wget Or Python, eddywinch82 15 14,550 May-20-2018, 06:05 PM
Last Post: eddywinch82

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020