Skip to content

Use of requests call without timeout parameter #7730

@Sai-Suraj-27

Description

@Sai-Suraj-27

Describe the bug

At few places in the codebase, where requests.get() is used, the timeout parameter is not specified.

image = PIL.Image.open(requests.get(image, stream=True).raw)

The timeout parameter is used to set the maximum time to wait for a response from the server. By omitting the timeout parameter, the program may hang indefinitely while awaiting a response.

From the documentation, we can see that the value of timeout can be mentioned in seconds (like 5 seconds).

I think it's good to use the timeout parameter with a value of 5 or 10 seconds.

Reproduction

image = PIL.Image.open(requests.get(image, stream=True).raw)

r = requests.get(
" https://raw.githubusercontent.com/CompVis/stable-diffusion/main/configs/stable-diffusion/v1-inference.yaml"

Logs

No response

System Info

This is a potential bug in the codebase, Irrespective of the python version, Diffusers version and platform.

Who can help?

@sayakpaul

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions