Sending KODI JSON works but not with user/pass. Help ?

(deleted)

So, that code works, but some other code that you didn't post does something that you don't want, or doesn't do something that you do want it to. You didn't think that such stuff is important?

(deleted)

(deleted)

and an optional username and password for HTTP's Basic Access Authentication

The username and password are not optional if using basic access authentication. How are you supplying them?

Where is the code that doesn't work?

(deleted)