708 | | |
| 708 | |
| 709 | def createSubscription(self, uri, events=["all"], |
| 710 | userdata=None, |
| 711 | recipient=None, |
| 712 | pullmethod=None, |
| 713 | charset=None, |
| 714 | naturallanguage=None, |
| 715 | leaseduration=None, |
| 716 | timeinterval=None, |
| 717 | jobid=None) : |
| 718 | """Creates a printer or server subscription.""" |
| 719 | req = self.newRequest(IPP_CREATE_PRINTER_SUBSCRIPTION) |
| 720 | req.operation["printer-uri"] = ("uri", uri) |
| 721 | for event in events : |
| 722 | req.subscription["notify-events"] = ("keyword", event) |
| 723 | if userdata is not None : |
| 724 | req.subscription["notify-user-data"] = ("octetString-with-an-unspecified-format", userdata) |
| 725 | if recipient is not None : |
| 726 | req.subscription["notify-recipient"] = ("uri", recipient) |
| 727 | if pullmethod is not None : |
| 728 | req.subscription["notify-pull-method"] = ("keyword", pullmethod) |
| 729 | if charset is not None : |
| 730 | req.subscription["notify-charset"] = ("charset", charset) |
| 731 | if naturallanguage is not None : |
| 732 | req.subscription["notify-natural-language"] = ("naturalLanguage", naturallanguage) |
| 733 | if leaseduration is not None : |
| 734 | req.subscription["notify-lease-duration"] = ("integer", leaseduration) |
| 735 | if timeinterval is not None : |
| 736 | req.subscription["notify-time-interval"] = ("integer", timeinterval) |
| 737 | if jobid is not None : |
| 738 | req.subscription["notify-job-id"] = ("integer", jobid) |
| 739 | return self.doRequest(req) |
| 740 | |
| 741 | |