This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
import os | |
import time | |
import requests | |
from PIL import Image | |
from StringIO import StringIO | |
from requests.exceptions import ConnectionError | |
def go(query, path): | |
"""Download full size images from Google image search. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# The idea is to do a HEAD request on a large file on an apache server with multiple byte ranges in multiple connections. | |
# The server then will have to read this large file from all the given byte ranges without returning any content | |
# (as it is a HEAD) request. If we do this about > 500 times in parallel the memory will collapse with | |
# the apache process crashing down. | |
import sys | |
import socket | |
header = '' |