Mastodon.py icon indicating copy to clipboard operation
Mastodon.py copied to clipboard

Can't remove header image from profile

Open jeancf opened this issue 2 years ago • 6 comments
trafficstars

I can't figure out out to remove the header image from a profile. I could not find anything in the documentation about it.

I tried using

Mastodon.account_update_credentials(header=None)

but it does nothing (BTW, ChatGPT is positive that this is the way to do it).

I also tried

Mastodon.account_update_credentials(header="")

But this throws an exception "Could not determine mime type or data passed directly without mime type"

jeancf avatar Jun 16 '23 11:06 jeancf

Honestly: Really good question. I don't know offhand how to do it. I'm at work right now, but I'll have a look at this once I get back home. Could be an oversight on my part, or an oversight on the mastodon side. The web UI uses an internal endpoint to delete the header that is not part of the API proper, POST-ing to "/settings/profile/pictures/header", the API docs for https://docs.joinmastodon.org/methods/accounts/#update_credentials don't specify a value that you might send as the new header to delete it.

I will mess around a bit later today to see if I can figure it out. Maybe it is possible to send a null value as multipart/form-data and that will make Mastodon do the intended thing, in which case I'd have to update the method to allow that type of thing, probably with a new parameter like "delete_header" / "delete_avatar".

halcy avatar Jun 16 '23 12:06 halcy

Hi there. Any luck with your attempt?

jeancf avatar Jun 27 '23 13:06 jeancf

Hey - sorry, I got distracted working on other parts of the codebase, and now I am busy with working on something else entirely. I will look at this again when I get back to trying to build the next release of Mastodon.py, but probably it will take at least a month before i get back to this.

Anyone else is welcome to have a look in the meantime, obviously.

halcy avatar Jun 28 '23 07:06 halcy

This isn't currently possible, mastodon bug: https://github.com/mastodon/mastodon/issues/18921

codl avatar Jun 28 '23 17:06 codl

mastodon 4.2.0 now has DELETE /api/v1/profile/avatar and DELETE /api/v1/profile/header https://docs.joinmastodon.org/methods/profile/

codl avatar Sep 22 '23 07:09 codl

Excellent news! Thanks a lot.

jeancf avatar Sep 24 '23 07:09 jeancf