urllib.request doesn't get passed the method so assumes it is a POST request breaking the request and the signature.
the required id parameter doesn't get passed as part of the url as the library assumes all required parameters are within the body. (This is an issue for the two PUT method API calls, I don't know if it is a bigger issue)
In diagnosing this I have a fix which I resolved this for my limited use case. I've forked the project and can submit a pull request, although appreciate I've not looked at any coding standards or similar so it may need additional work.
I'm trying to use the twitter.direct_messages.welcome_messages.update end point, however this uses the PUT method (https://developer.twitter.com/en/docs/direct-messages/welcome-messages/api-reference/update-welcome-message) and there appeared to be various issues with both the signature and the request because:
In diagnosing this I have a fix which I resolved this for my limited use case. I've forked the project and can submit a pull request, although appreciate I've not looked at any coding standards or similar so it may need additional work.