写一个调用API的代码示例.
``python进口请求 url = "https://api.example.com/data" # 定义GET请求参数的参数 = { "api_key": "YOUR_API_KEY", "format" : "json", "date": "2021-08-04" } # 将GET请求提交到API响应 = requests.get(url, params=parameters) # 检查如果响应成功,如果响应.status_code == requests.codes.ok: data = response.json() # 根据需要处理数据: print (("有问题发生了:",响应.status_code) ```