# Python API Send posts

**URL:** https://meta.discourse.org/t/python-api-send-posts/205161
**Category:** Development
**Tags:** rest-api
**Created:** [October 4, 2021, 2:56pm UTC](https://meta.discourse.org/t/python-api-send-posts/205161 "2021-10-04T14:56:19Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![FunnySmile](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/funnysmile/32/229095_2.png) [@FunnySmile](https://meta.discourse.org/u/FunnySmile)
#### Post date: [October 4, 2021, 2:56pm UTC](https://meta.discourse.org/t/python-api-send-posts/205161/1 "2021-10-04T14:56:19Z")

</div>

If you need to use Python to post to your forum, I’m sure this code will definitely help.

First of all, please get the tool post, [tools](https://meta.discourse.org/t/a-new-python-api/191974).

Or get the package directly:

> pip install fluent-discourse

For more interfaces, see:

> [Discourse API Docs](https://docs.discourse.org/#operation/listPosts)

Thank you very much for simplifying the amount of code in the Python request API.

```plaintext
from fluent_discourse import Discourse
client = Discourse(base_url="url", username="user_name",
                   api_key="user_key", raise_for_rate_limit=True)
data = {
    'title': '',
# content
    'raw': '',
# Get a post ID when you need to reply to a post
# 'topic_id': '5',
# Category ID
   'category': '5',
# tags
    'tags': ['Label 1', 'Label 2'],

}
latest = client.posts.json.post(data)

```

You can use the API to reply or post a new topic if you only need to change what you need.  
I’m sorry that there may be some mistakes in the description of this article, because English is not my mother tongue. Thank you for your understanding.

---

<div class="post-metadata">

### Author: ![FunnySmile](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/funnysmile/32/229095_2.png) [@FunnySmile](https://meta.discourse.org/u/FunnySmile)
#### Post date: [October 4, 2021, 3:01pm UTC](https://meta.discourse.org/t/python-api-send-posts/205161/2 "2021-10-04T15:01:44Z")

</div>

I’ll show you how to get the category ID and post ID later.

---

<div class="post-metadata">

### Author: ![valsha](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/valsha/32/230631_2.png) [@valsha](https://meta.discourse.org/u/valsha)
#### Post date: [October 21, 2021, 1:55pm UTC](https://meta.discourse.org/t/python-api-send-posts/205161/3 "2021-10-21T13:55:46Z")

</div>

Can you post an example 🙂 Thank you.

---

<div class="post-metadata">

### Author: ![FunnySmile](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/funnysmile/32/229095_2.png) [@FunnySmile](https://meta.discourse.org/u/FunnySmile)
#### Post date: [December 14, 2021, 12:32pm UTC](https://meta.discourse.org/t/python-api-send-posts/205161/4 "2021-12-14T12:32:02Z")

</div>

Uncaught (in promise) no-response: no-response

---

<div class="post-metadata">

### Author: ![FunnySmile](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/funnysmile/32/229095_2.png) [@FunnySmile](https://meta.discourse.org/u/FunnySmile)
#### Post date: [December 14, 2021, 12:32pm UTC](https://meta.discourse.org/t/python-api-send-posts/205161/5 "2021-12-14T12:32:36Z")

</div>

I’m sorry that I’ve been too busy to write any more useful Python examples

---

<div class="post-metadata">

### Author: ![mapengfei-nwpu](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mapengfei-nwpu/32/203450_2.png) [@mapengfei-nwpu](https://meta.discourse.org/u/mapengfei-nwpu)
#### Post date: [January 14, 2022, 5:46pm UTC](https://meta.discourse.org/t/python-api-send-posts/205161/6 "2022-01-14T17:46:58Z")

</div>

I tried it and it works. Thank you very much!
