lunduke-cli/examples/update_user.py

23 lines
572 B
Python
Raw Permalink Normal View History

from config.configuration import Config
from lunduke.client import DiscourseClient
def main():
user = Config().username
client = DiscourseClient()
# https://docs.discourse.org/#tag/Users/operation/updateUser
# TODO: FAILS: 404
put_data = {
"location": "cyberspace",
"external_ids": {}
}
try:
response = client.put(f"/u/{user}.json", data=put_data)
print(response.status_code)
print(response.json())
except Exception as e:
print(f"Error: {e}")
if __name__ == "__main__":
main()