Giter Club home page Giter Club logo

Comments (15)

Hellowlol avatar Hellowlol commented on May 5, 2024

You can do what with requests already just set the content type header to application/json and use r.json()

from python-plexapi.

pkkid avatar pkkid commented on May 5, 2024

@Hellowlol - OMG, I have been hating using the XML view of the PlexAPI!

from python-plexapi.

Hellowlol avatar Hellowlol commented on May 5, 2024

Srsly? Lol. I just figured you used it since you like it better.

from python-plexapi.

pkkid avatar pkkid commented on May 5, 2024

I wish, I started this project about a year and a half ago and documentation was super sparse then (not there there is a ton of documentation now). Anyway, if this works I'll totally update this to use JSON everywhere, it's 1000x easier to work with.

from python-plexapi.

pkkid avatar pkkid commented on May 5, 2024

It doesn't seem to be working for me.

import requests
from plexapi.server import PlexServer

plex = PlexServer('http://HOST:32400', 'TOKEN')
url = plex.url('/status/sessions/history/all')
headers = plex.headers()
headers['Content-Type'] = 'application/json'
response = requests.get(url, headers=headers)
print(response.text[:1000])  # should show a json string?

Shouldn't I expect a json string to be printed there?

from python-plexapi.

Hellowlol avatar Hellowlol commented on May 5, 2024

Dunno how long it has worked but ive been using json since 15 Jan 2014. (It was broken but some dude made a repair function)

from python-plexapi.

Hellowlol avatar Hellowlol commented on May 5, 2024

Sec, i have never tested that url, i have only used the other ones, i just figured it worked since every other i have tried has worked.

from python-plexapi.

Hellowlol avatar Hellowlol commented on May 5, 2024

Ah, sorry it was 'Accept': 'application/json' not the content type

from python-plexapi.

pkkid avatar pkkid commented on May 5, 2024

Awesome, thanks!

from python-plexapi.

Hellowlol avatar Hellowlol commented on May 5, 2024

Im happy to help, its the least i can do. The api is beautiful :)

from python-plexapi.

pkkid avatar pkkid commented on May 5, 2024

commit 80529a2
Author: Michael Shepanski [email protected]
Date: Thu Apr 7 01:39:04 2016 -0400
Rename MyPlexUser to MyPlexAccount; Add support for real MyPlexUsers; Add api for history; New tests for sessions() and history()

from python-plexapi.

Hellowlol avatar Hellowlol commented on May 5, 2024

Any plans to add to add any query regarding the history?

@mratsamy if you want some simple watched stats you can find a simple script here: https://gist.github.com/Hellowlol/0047e27e2e17593b48ab708312956b71

from python-plexapi.

pkkid avatar pkkid commented on May 5, 2024

I think that is slightly out of scope of what I wanted this package to do. Essentially I want to provide the ability to read and navigate what Plex is providing in their xml docs, but leave the 'build cool stuff on top of it' to everyone else. It's definetly worth an example or two though.

commit 81e2214
Author: Michael Shepanski [email protected]
Date: Thu Apr 7 22:48:45 2016 -0400
Get examples working again; Add new examples most_streamed_titles and most_active_users

As a side note. Do you know if we have any filter options on the history? This history takes quite a while to load on my system with something like 10000+ items from all this testing. 😮

from python-plexapi.

Hellowlol avatar Hellowlol commented on May 5, 2024

Ok. Im afraid not. 10000? Shit my history only had like 4k ish. It seems that grabbing the history from plex is the slowest, not the parsing.

from python-plexapi.

ovived avatar ovived commented on May 5, 2024

how come i dont get json when i do this

from python-plexapi.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.