jellyfin / jellyfin/jellyfin-apiclient-python
README Examples Incorrect/Don't Work
- Dominant language
- Python
- Stars
- 149
- Forks
- 42
- PR merge metrics
- No merged PRs in 30d
Description
The line in the README is not correct, as it contains no closing curly bracket
```
client.authenticate({"Servers": [credentials], discover=False)
```
This should likely be
```
client.authenticate({"Servers": [credentials]}, discover=False)
```
However, the authentication does not seem to work as noted. I can run the initial portion where you connect with a username/password, and I receive data that can be encoded to JSON.
This portion
```
json.loads(data)
client.authenticate({"Servers": [data]}, discover=False)
```
fails with this error
```
jellyfin_apiclient_python\connection_manager.py", line 88, in get_available_servers
servers.sort(key=itemgetter('DateLastAccessed'), reverse=True)
TypeError: string indices must be integers, not 'str'
```
Presumably one is meant to decode the data into a new object and pass that to the `authenticate()` method. However
```
creds = json.loads(data)
client.authenticate({"Servers": [creds]}, discover=False)
```
results in the following
```
jellyfin_apiclient_python\api.py", line 512, in get_default_headers
auth += "Client=%s, " % self.config.data['app.name']
~~~~~~~~~~~~~~~~^^^^^^^^^^^^
KeyError: 'app.name'
Failing server connection. ERROR msg: 'app.name'
```
I have looked at the resulting JSON and there are no keys that might correspond to `app.name`.
Contributor guide
Research direction
Start with the README examples and trace authenticate() through jellyfin_apiclient_python/connection_manager.py, especially get_available_servers, and api.py at get_default_headers. Reproduce the documented flow with the decoded server data and determine the expected input shape; done means the README example is syntactically correct and authentication completes without the reported TypeError or app.name KeyError.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- api, authentication, documentation
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100