@@ -223,7 +223,7 @@ def fromdriver(cls, driver, devmode=False):
223223 return cls (image_bytes_array , image_link , devmode )
224224
225225 @classmethod
226- def fromlink (cls , image_link , devmode = False ):
226+ def fromlink (cls , image_link , devmode = False , timeout = 120 ):
227227 """
228228 Requests the given link and stores the content of the response
229229 as `io.BytesIO` that is then used to create AmazonCaptcha instance.
@@ -234,6 +234,7 @@ def fromlink(cls, image_link, devmode=False):
234234 link (str): Link to Amazon's captcha image.
235235 devmode (bool, optional): If set to True, instead of 'Not solved',
236236 unrecognised letters will be replaced with dashes.
237+ timeout (int, optional): Requests timeout.
237238
238239 Returns:
239240 AmazonCaptcha: Instance created based on the image link.
@@ -244,7 +245,7 @@ def fromlink(cls, image_link, devmode=False):
244245
245246 """
246247
247- response = requests .get (image_link )
248+ response = requests .get (image_link , timeout = timeout )
248249
249250 if response .headers ['Content-Type' ] not in SUPPORTED_CONTENT_TYPES :
250251 raise ContentTypeError (response .headers ['Content-Type' ])
0 commit comments