---
# System prepended metadata

title: 1. date_list

---

```python=
import requests
import json

# 1. date_list
date_list = ["2023-06-01","2023-06-02","2023-06-03","2023-06-04"]

for d in date_list:

    # 1. 目標 url
    url = f"https://www.tdm.com.mo/api/v1.0/news?IsShowSevenDay=true&Type=image&Date={d}&Lang=zh"

    # 2. 向目標發送請求(request)
    response = requests.get(url)

    json_data = json.loads(response.content)

    target_data = json_data["data"]["newsList"]

    for i in target_data:
        for j in i["data"]:
            if("治安" in j["content"]):
                print(f'{j["date"]} : {j["title"]}')
                print(f'{j["content"]}')
                print("######################")
```
