Comments (15)
You can do what with requests already just set the content type header to application/json and use r.json()
from python-plexapi.
@Hellowlol - OMG, I have been hating using the XML view of the PlexAPI!
from python-plexapi.
Srsly? Lol. I just figured you used it since you like it better.
from python-plexapi.
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.
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.
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.
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.
Ah, sorry it was 'Accept': 'application/json' not the content type
from python-plexapi.
Awesome, thanks!
from python-plexapi.
Im happy to help, its the least i can do. The api is beautiful :)
from python-plexapi.
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.
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.
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.
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.
how come i dont get json when i do this
from python-plexapi.
Related Issues (20)
- Unable to connect to a Plex HTPC client HOT 3
- Add Type Hints to Improve Codebase Readability and Maintainability HOT 1
- Show and Season from the video module use wrong key to get subtitleLanguage attribute
- Add support for track genres in music libraries HOT 1
- feat: python class for available filters HOT 3
- Add support for Plex Profile Watch History and Ratings
- Library section lookup clobbered when multiple libraries have the same title
- editAlbum Missing ... HOT 1
- Unable to find Libraries after using PlexApi based python script. HOT 5
- locations is empty when casting to dict HOT 2
- Add 'merge' method for music albums
- Ability to Modify MovieHistory & EpisodeHistory details HOT 1
- Bad Request response when adding library with default language
- Issues creating `PlexClient` instances from `PlexServer` sessions in 4.15.8 HOT 1
- feat: Endpoint for computing sonic adventure
- Add View History Manually HOT 2
- Streams in MediaParts empty (reload() has no effect)
- `totalSize` of MediaContainer
- createPlaylist does not guard smart=True and non-empty items HOT 2
- "Invalid library sectionID: None" after PlexPartialObject.reload() HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from python-plexapi.