Did The API Change For /Users/AuthenticateByName?

Need some help getting the AuthenticateByName call to work on my test server with 10.8.0.

Looks like there may be API changes coming in 10.8.0 version. I am using the API Docs built into the server - http://watch.tv/jellyfin/api-docs/swagger/index.html. As well as the API Docs located here - Jellyfin - ReDoc. I must not understand what has changed.

The below python script function call works with the current stable version but no longer works with the 10.8.0 version:

def get_auth_key(server_url, username, password, password_sha1):
    #Get Auth Token for admin account
    values = {'Username' : username, 'Password' : password_sha1, 'Pw' : password}
    DATA = urllib.parse.urlencode(values)
    DATA = DATA.encode('ascii')

    headers = {'X-Emby-Authorization' : 'Emby UserId="'+ username  +'", Client="media_cleaner", Device="media_cleaner", DeviceId="media_cleaner", Version="0.2", Token=""'}

    req = request.Request(url=server_url +'/Users/AuthenticateByName', data=DATA,method='POST', headers=headers)

    with request.urlopen(req) as response:
        if response.getcode() == 200:
        source = response.read()
        data = json.loads(source)

        #DEBUG
        #jprint(data)
    else:
        print('An error occurred while attempting to retrieve data from the API.')

return(data['AccessToken'])

Above Variable Contents:

server_url = http://watch.tv/jellyfin
values = {'Username': 'Hieroglyph.Admin', 'Password': '8dd84bdbf504f52bdcccb08b1dd456d1fdf000c3', 'Pw': '76X9Vw6E36C2bNc5xkAj25MaRwtzRFKP'}
DATA = Username=Hieroglyph.Admin&Password=8dd84bdbf504f52bdcccb08b1dd456d1fdf000c3&Pw=76X9Vw6E36C2bNc5xkAj25MaRwtzRFKP
headers = {'X-Emby-Authorization': 'Emby UserId="Hieroglyph.Admin", Client="media_cleaner", Device="media_cleaner", DeviceId="media_cleaner", Version="0.2", Token=""'}

End up with a urllib.error.HTTPError: HTTP Error 415: Unsupported Media Type error:

Traceback (most recent call last):
  File "./media_cleaner.py", line 678, in <module>
    auth_key=get_auth_key(server_url, username, password, password_sha1)
  File "./media_cleaner.py", line 254, in get_auth_key
    with request.urlopen(req) as response:
  File "/usr/local/lib/python3.8/urllib/request.py", line 222, in urlopen
    return opener.open(url, data, timeout)
  File "/usr/local/lib/python3.8/urllib/request.py", line 531, in open
    response = meth(req, response)
  File "/usr/local/lib/python3.8/urllib/request.py", line 640, in http_response
    response = self.parent.error(
  File "/usr/local/lib/python3.8/urllib/request.py", line 569, in error
    return self._call_chain(*args)
  File "/usr/local/lib/python3.8/urllib/request.py", line 502, in _call_chain
    result = func(*args)
  File "/usr/local/lib/python3.8/urllib/request.py", line 649, in http_error_default
    raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 415: Unsupported Media Type

Am I supposed to specify applicaiton/json as the Media Type?
And if so, how do I do that?

I was able to get the following curl command to work.

curl -X POST "http://watch.tv/jellyfin/Users/AuthenticateByName" -H "X-Emby-Authorization: Emby UserId="Hieroglyph.Admin", Client="media_cleaner", Device="media_cleaner", DeviceId="media_cleaner", Version="0.2", Token=""" -H  "Content-Type: application/json" -d "{\"Username\":\"Hieroglyph.Admin\",\"Password\":\"8dd84bdbf504f52bdcccb08b1dd456d1fdf000c3\",\"Pw\":\"76X9Vw6E36C2bNc5xkAj25MaRwtzRFKP\"}"

Put the above curl command into an online “curl to python” converter to see what I was missing. This is what I was given:

import requests

headers = {
'X-Emby-Authorization': 'Emby UserId=Hieroglyph.Admin, Client=media_cleaner, Device=media_cleaner, DeviceId=media_cleaner, Version=0.2, Token=',
'Content-Type': 'application/json',
}

data = '{"Username":"Hieroglyph.Admin ","Password":"8dd84bdbf504f52bdcccb08b1dd456d1fdf000c3","Pw":"76X9Vw6E36C2bNc5xkAj25MaRwtzRFKP"}'

response = requests.post('http://watch.tv/jellyfin/Users/AuthenticateByName', headers=headers, data=data)

Ok. The only difference is the addition of Content-Type. So I update my header to include ,‘Content-Type’: ‘application/json’. Everything else is the same.

def get_auth_key(server_url, username, password, password_sha1):
#Get Auth Token for admin account
values = {'Username' : username, 'Password' : password_sha1, 'Pw' : password}
DATA = urllib.parse.urlencode(values)
DATA = DATA.encode('ascii')

headers = {'X-Emby-Authorization' : 'Emby UserId="'+ username  +'", Client="media_cleaner", Device="media_cleaner", DeviceId="media_cleaner", Version="0.2", Token=""', 'Content-Type': 'application/json'}

req = request.Request(url=server_url +'/Users/AuthenticateByName', data=DATA,method='POST', headers=headers)

with request.urlopen(req) as response:
    if response.getcode() == 200:
    source = response.read()
    data = json.loads(source)

    #DEBUG
    #jprint(data)
else:
    print('An error occurred while attempting to retrieve data from the API.')

return(data['AccessToken'])

Now it tells me I am sending a bad request:

Traceback (most recent call last):
  File "./media_cleaner.py", line 680, in <module>
    auth_key=get_auth_key(server_url, username, password, password_sha1)
  File "./media_cleaner.py", line 256, in get_auth_key
    with request.urlopen(req) as response:
  File "/usr/local/lib/python3.8/urllib/request.py", line 222, in urlopen
    return opener.open(url, data, timeout)
  File "/usr/local/lib/python3.8/urllib/request.py", line 531, in open
    response = meth(req, response)
  File "/usr/local/lib/python3.8/urllib/request.py", line 640, in http_response
    response = self.parent.error(
  File "/usr/local/lib/python3.8/urllib/request.py", line 569, in error
    return self._call_chain(*args)
  File "/usr/local/lib/python3.8/urllib/request.py", line 502, in _call_chain
    result = func(*args)
  File "/usr/local/lib/python3.8/urllib/request.py", line 649, in http_error_default
    raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 400: Bad Request

Does not seem like Content-Type is what jellyfin is looking for. Anyone able to help determine what I am missing here?

Downgraded from 10.8.0 to 10.7.0 and still getting the same errors.

Getting the same error in Python3.6, 3.7, and 3.8.