Sì, in realtà sì.
category_notifications = {'muted_category_ids': [54],
'regular_category_ids': [],
'tracked_category_ids': [],
'watched_category_ids': [],
'watched_first_post_category_ids': [61],
}
api(config, f\"u/{username}.json\", method='put',
json=category_notifications)
… dove api() è un sottile wrapper attorno al modulo Python Requests e si limita a eseguire una richiesta HTTP PUT a /u/whateverusernameyouarechanging.json sul tuo sito Discourse, e il payload sono solo le categorie che desideri modificare. (Puoi saltare quelle che non vuoi modificare.)
Nota che sono necessari gli ID numerici delle categorie, i nomi non funzioneranno. E naturalmente, se vuoi unire o preservare ciò che è già presente, dovrai prima leggere l’utente.