Currently i am trying to create a python script that will run my sickbeard api code by requesting the special url and grabbing the information. It is outputting the below code which is correct:
{
"data": {
"missed": [
{
"airdate": "2014-03-27",
"airs": "Friday 02:05",
"ep_name": "Episode 24",
"ep_plot": "",
"episode": 24,
"network": "MBS",
"paused": 0,
"quality": "SD",
"season": 1,
"show_name": "Kill la Kill",
"show_status": "Continuing",
"tvdbid": 272074,
"weekday": 4
},
{
"airdate": "2014-03-27",
"airs": "Thursday 10:00 PM",
"ep_name": "Tyga",
"ep_plot": "",
"episode": 18,
"network": "MTV",
"paused": 0,
"quality": "SD",
"season": 4,
"show_name": "Ridiculousness",
"show_status": "Continuing",
"tvdbid": 250793,
"weekday": 4
},
{
"airdate": "2014-03-27",
"airs": "Thursday 10:00 PM",
"ep_name": "Guy Fieri",
"ep_plot": "",
"episode": 19,
"network": "MTV",
"paused": 0,
"quality": "SD",
"season": 4,
"show_name": "Ridiculousness",
"show_status": "Continuing",
"tvdbid": 250793,
"weekday": 4
}
]
},
"message": "",
"result": "success"
}
Now i want it to only display the line with the keyword "show_name". for example i want it to just display "kill la kill", ridiculousness and ridiculousness. I will be using this so if i say the command "what shows are on today" it will run the python script and output the shows that are on today. Whenever i run the code it just runs and displays nothing.
from urllib2 import Request, urlopen, URLError
request = Request('http://192.168.1.***:8081/api/*****/?cmd=future&sort=date&type=missed')
try:
response = urlopen(request)
tv_shows = response.read()
for single_line in tv_shows:
if 'show_name' in single_line:
print single_line
except URLError, e:
print ('Error')
Im very new to python programming so any help is much appreciated.