Skip to main content
Commonmark migration
Source Link

###Imports

Imports

###Constants

Constants

###Functions

Functions

###All the code

All the code

###Imports

###Constants

###Functions

###All the code

Imports

Constants

Functions

All the code

replaced http://stackoverflow.com/ with https://stackoverflow.com/
Source Link

If you don't know what's with if __name__ == '__main__' you can read more about it herehere

If you don't know what's with if __name__ == '__main__' you can read more about it here

If you don't know what's with if __name__ == '__main__' you can read more about it here

added 244 characters in body
Source Link
Grajdeanu Alex
  • 9.2k
  • 4
  • 31
  • 70
def download_images(soup):
    """Docstring here."""
    for link in soup.findAllfind_all('img'):
        image_url = link.get('src')
        if validate(image_url):
            image = requests.get(image_url)
            if image.status_code == 200:
                with open(image_name(), 'wb') as f:
                    f.write(image.content)

If you don't know what's with if __name__ == '__main__' you can read more about it here

More, note that all the functions have a docstring which contain a placeholder like "Docstring here.". You can replace that placeholder with a summary that describes what each function does.

def download_images(soup):
    """Docstring here."""
    for link in soup.findAll('img'):
        image_url = link.get('src')
        if validate(image_url):
            image = requests.get(image_url)
            if image.status_code == 200:
                with open(image_name(), 'wb') as f:
                    f.write(image.content)

If you don't know what's with if __name__ == '__main__' you can read more about it here

def download_images(soup):
    """Docstring here."""
    for link in soup.find_all('img'):
        image_url = link.get('src')
        if validate(image_url):
            image = requests.get(image_url)
            if image.status_code == 200:
                with open(image_name(), 'wb') as f:
                    f.write(image.content)

If you don't know what's with if __name__ == '__main__' you can read more about it here

More, note that all the functions have a docstring which contain a placeholder like "Docstring here.". You can replace that placeholder with a summary that describes what each function does.

added 114 characters in body
Source Link
Grajdeanu Alex
  • 9.2k
  • 4
  • 31
  • 70
Loading
added 4 characters in body
Source Link
Grajdeanu Alex
  • 9.2k
  • 4
  • 31
  • 70
Loading
Source Link
Grajdeanu Alex
  • 9.2k
  • 4
  • 31
  • 70
Loading