Jump to content

Help: API Query for EMBY Movie Item Info Returns HTTP 500 Error


Go to solution Solved by gresizoq,

Recommended Posts

Posted


When I try to retrieve information for an item with a specified ID, it always returns an HTTP 500 error.

 

The code is as follows:

movie_id = '429692' 

The ID 429692 is parsed from data returned by another API from the Emby server, and the corresponding movie does exist.


def emby_get_item_info():

    # Set API request headers
    headers = {
        'X-Emby-Token': api_key
    }

    movie_id = '429692'
    # Get the API endpoint for the movie
    detail_item_endpoint = f'{emby_url}/users/{user_id}/items/{movie_id}'


    detail_item_response = requests.get(detail_item_endpoint, headers=headers)

    if detail_item_response.status_code == 200:
        print("Successfully retrieved complete movie information")
        movie_data = detail_item_response.json()
        # Dynamically parse all fields in the JSON data
        print("\nParsed fields:")
        for key, value in movie_data.items():
            print(f"{key}: {value}")
    else:
        print(f"Failed to retrieve complete movie information, status code: {detail_item_response.status_code}")
        print(f"Response content: {detail_item_response.text}")
    
    
    
emby_get_item_info error log:

Failed to retrieve complete movie information, status code: 500
Response content: Guid should contain 32 digits with 4 dashes (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx).
 

Please give me some modification suggestions, thank you.

error 500.jpg

Posted

Hi, what's in the emby server log?

  • Solution
Posted

 

Thanks for your attention.

I have solved this issue.

I used Wireshark to capture the traffic from  http://192.168.2.42:8096/web/index.html#!/home and upon comparing the HTTP headers,

I found that the user-name field was a string of characters 'cefa80922459464484efxxxxxxxx14b8' instead of 'WIZ-LT'.

When I used this string of characters as the username, the code worked.

I don't understand why.

 

emby_url = "http://192.168.2.42:8096"
api_key = "850d6a3a78bc4ec6b584077b34b2a956"
user_id = 'cefa80922459464484efxxxxxxxx14b8'  # "WIZ-LT" not work
 
item_info_endpoint = f'{emby_url}/users/{user_id}/items/{movie_id}
 
  • Thanks 1

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...