# 将主题中的帖子标记为“已读”

**URL:** https://meta.discourse.org/t/mark-posts-in-topic-as-read/394852
**Category:** Development
**Tags:** rest-api
**Created:** [2026年一月31日 15:32 UTC](https://meta.discourse.org/t/mark-posts-in-topic-as-read/394852 "2026-01-31T15:32:42Z")
**Posts on this page:** 1
**Showing post:** 7

<div class="post-metadata">

### Author: ![Canapin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/canapin/32/119591_2.png) [@Canapin](https://meta.discourse.org/u/Canapin)
#### Post date: [2026年二月5日 23:01 UTC](https://meta.discourse.org/t/mark-posts-in-topic-as-read/394852/7 "2026-02-05T23:01:27Z")

</div>

This works:

```py
def load_topics(session, page):
    print(f"[Topics] 正在加载第 {page} 页")
    r = session.get(f"https://{hostUrl}/latest.json?page={page}")
    if r.status_code != 200:
        return []
    return [{"id": t["id"], "posts_count": t["posts_count"]} for t in r.json()["topic_list"]["topics"]]

```

```py
    timings = {
        str(i): 60000
        for i in range(1, post_count + 1)
    }
    payload = {
        "topic_id": topic_id,
        "topic_time": post_count * 60000,
        "timings": timings 
    }    

    # 使用 json=payload 发送 application/json
    r = session.post(url, json=payload, headers = {
        "X-CSRF-Token": csrf,
        "User-Agent": "Mozilla/5.0",
        "X-Requested-With": "XMLHttpRequest",
        "Content-Type": "application/json"
      }
    )

```

---

_[View the full topic](https://meta.discourse.org/t/mark-posts-in-topic-as-read/394852)._
