import requests

def retrieve_json(url):
    r = requests.get(url)
    r.raise_for_status()
    return r.json()

import requests


DEFAULT_TIMEOUT = 10


def retrieve_json(url, timeout=DEFAULT_TIMEOUT):
    r = requests.get(url, timeout=timeout)
    r.raise_for_status()
    return r.json()

Add a default timeout parameter to retrieve_json
Add a default timeout parameter to retrieve_json

  import requests
  
- def retrieve_json(url):
-     r = requests.get(url)
+ 
+ DEFAULT_TIMEOUT = 10
+ 
+ 
+ def retrieve_json(url, timeout=DEFAULT_TIMEOUT):
+     r = requests.get(url, timeout=timeout)
      r.raise_for_status()
      return r.json()
  
Add a default timeout parameter to retrieve_json
## Code Before:
import requests

def retrieve_json(url):
    r = requests.get(url)
    r.raise_for_status()
    return r.json()

## Instruction:
Add a default timeout parameter to retrieve_json
## Code After:
import requests


DEFAULT_TIMEOUT = 10


def retrieve_json(url, timeout=DEFAULT_TIMEOUT):
    r = requests.get(url, timeout=timeout)
    r.raise_for_status()
    return r.json()
