<div dir="ltr">On Fri, Oct 12, 2018 at 7:28 PM Bill Meek <<a href="mailto:keemllib@gmail.com">keemllib@gmail.com</a>> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On 10/12/2018 07:49 PM, John P Poet wrote:<br>
> I see AddRecordSchedule here<br>
> <a href="https://www.mythtv.org/wiki/API_parameters_29#Dvr_service" rel="noreferrer" target="_blank">https://www.mythtv.org/wiki/API_parameters_29#Dvr_service</a> but when I try to<br>
> use it, I am getting a 500 response.  Is this not working, or am I not<br>
> calling it correctly?<br>
> <br>
> I am calling it from python:<br>
> <br>
>      endpoint = 'Dvr/AddRecordSchedule'<br>
>      post = recrule.asDict()<br>
>      opt = {'wrmi':True}<br>
> <br>
>      try:<br>
>          resp_dict = backend.send(endpoint=endpoint, postdata=post, opts=opt)<br>
>      except RuntimeError as error:<br>
>          sys.exit('\nFatal error: "{}"'.format(error))<br>
>      except RuntimeWarning as warning:<br>
>          print('Warning: {}'.format(warning))<br>
> <br>
> recrule is a classed derived from a named tuple with the various arguments<br>
> in it, for example: ChanId, Title, Subtitle, etc.<br>
> <br>
> I admit to not having a lot of python experience, but this seems pretty<br>
> straight forward.  I just want to verify that the Dvr/AddRecordSchedule is<br>
> supposed to be working, before I waste a lot of time debugging this code.<br>
> Various other Services API calls are working perfectly.<br>
<br>
It does work. My usual 1st choice is: mythbackend --setverbose http:debug,upnp:debug<br>
(probably overkill.) And check the backend log...<br>
<br>
Here's a snippet from one of my tests:<br>
<br>
     endpoint = 'Dvr/AddRecordSchedule'<br>
<br>
     params_not_sent = ('AverageDelay', 'CallSign', 'Id', 'LastDeleted',<br>
                        'LastRecorded', 'NextRecording', 'ParentId')<br>
<br>
     for param in params_not_sent:<br>
         try:<br>
             del template[param]<br>
         except KeyError:<br>
             pass<br>
     ...<br>
<br>
<br>
I also use:<br>
<br>
     logging.basicConfig(level=logging.DEBUG if args['debug'] else logging.INFO)<br>
     logging.getLogger('requests.packages.urllib3').setLevel(logging.WARNING)<br>
     logging.getLogger('urllib3.connectionpool').setLevel(logging.WARNING)<br>
<br>
and a --debug switch to the Python program to activate the log messages. The<br>
send.py you're using has a bit more on the above.<br>
<br>
I attached my add_recording_rule.py FYI. The command line (just to test, without --wrmi):<br>
add_recording_rule.py --ho ofc0 --title Elementary --debug --digest admin:mythtv<br>
<br>
-- <br>
Bill<br>
_______________________________________________<br>
mythtv-dev mailing list<br>
<a href="mailto:mythtv-dev@mythtv.org" target="_blank">mythtv-dev@mythtv.org</a><br>
<a href="http://lists.mythtv.org/mailman/listinfo/mythtv-dev" rel="noreferrer" target="_blank">http://lists.mythtv.org/mailman/listinfo/mythtv-dev</a><br>
<a href="http://wiki.mythtv.org/Mailing_List_etiquette" rel="noreferrer" target="_blank">http://wiki.mythtv.org/Mailing_List_etiquette</a><br>
MythTV Forums: <a href="https://forum.mythtv.org" rel="noreferrer" target="_blank">https://forum.mythtv.org</a></blockquote><div><br></div><div>Thanks Bill, that should help.</div><div><br></div><div>John<br></div></div></div>