#!/usr/bin/env python # # Copyright 2007 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # from google.net.proto import ProtocolBuffer import array import dummy_thread as thread from google3.net.proto import _net_proto___parse__python try: __import__('google.net.rpc.python.rpc_internals') __import__('google.net.rpc.python.pywraprpc') import sys rpc_internals = sys.modules.get('google.net.rpc.python.rpc_internals') pywraprpc = sys.modules.get('google.net.rpc.python.pywraprpc') _client_stub_base_class = rpc_internals.StubbyRPCBaseStub except ImportError: _client_stub_base_class = object __pychecker__ = """maxreturns=0 maxbranches=0 no-callinit unusednames=printElemNumber,debug_strs no-special""" from google.appengine.api.api_base_pb import VoidProto class MailServiceError(ProtocolBuffer.ProtocolMessage): OK = 0 INTERNAL_ERROR = 1 BAD_REQUEST = 2 UNAUTHORIZED_SENDER = 3 INVALID_ATTACHMENT_TYPE = 4 _ErrorCode_NAMES = { 0: "OK", 1: "INTERNAL_ERROR", 2: "BAD_REQUEST", 3: "UNAUTHORIZED_SENDER", 4: "INVALID_ATTACHMENT_TYPE", } def ErrorCode_Name(cls, x): return cls._ErrorCode_NAMES.get(x, "") ErrorCode_Name = classmethod(ErrorCode_Name) def __init__(self, contents=None): pass if contents is not None: self.MergeFromString(contents) def MergeFrom(self, x): assert x is not self def _CMergeFromString(self, s): _net_proto___parse__python.MergeFromString(self, 'apphosting.MailServiceError', s) def _CEncode(self): return _net_proto___parse__python.Encode(self, 'apphosting.MailServiceError') def _CToASCII(self, output_format): return _net_proto___parse__python.ToASCII(self, 'apphosting.MailServiceError', output_format) def ParseASCII(self, s): _net_proto___parse__python.ParseASCII(self, 'apphosting.MailServiceError', s) def Equals(self, x): if x is self: return 1 return 1 def __eq__(self, other): return (other is not None) and (other.__class__ == self.__class__) and self.Equals(other) def __ne__(self, other): return not (self == other) def IsInitialized(self, debug_strs=None): initialized = 1 return initialized def ByteSize(self): n = 0 return n + 0 def Clear(self): pass def OutputUnchecked(self, out): pass def TryMerge(self, d): while d.avail() > 0: tt = d.getVarInt32() if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError d.skipData(tt) def __str__(self, prefix="", printElemNumber=0): res="" return res _TEXT = ( "ErrorCode", ) _TYPES = ( ProtocolBuffer.Encoder.NUMERIC, ) _STYLE = """""" _STYLE_CONTENT_TYPE = """""" _SERIALIZED_DESCRIPTOR = array.array('B', [ 0x5a, 0x21, 0x61, 0x70, 0x70, 0x68, 0x6f, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x6d, 0x61, 0x69, 0x6c, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x0a, 0x1b, 0x61, 0x70, 0x70, 0x68, 0x6f, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x4d, 0x61, 0x69, 0x6c, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x73, 0x7a, 0x09, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x43, 0x6f, 0x64, 0x65, 0x8b, 0x01, 0x92, 0x01, 0x02, 0x4f, 0x4b, 0x98, 0x01, 0x00, 0x8c, 0x01, 0x8b, 0x01, 0x92, 0x01, 0x0e, 0x49, 0x4e, 0x54, 0x45, 0x52, 0x4e, 0x41, 0x4c, 0x5f, 0x45, 0x52, 0x52, 0x4f, 0x52, 0x98, 0x01, 0x01, 0x8c, 0x01, 0x8b, 0x01, 0x92, 0x01, 0x0b, 0x42, 0x41, 0x44, 0x5f, 0x52, 0x45, 0x51, 0x55, 0x45, 0x53, 0x54, 0x98, 0x01, 0x02, 0x8c, 0x01, 0x8b, 0x01, 0x92, 0x01, 0x13, 0x55, 0x4e, 0x41, 0x55, 0x54, 0x48, 0x4f, 0x52, 0x49, 0x5a, 0x45, 0x44, 0x5f, 0x53, 0x45, 0x4e, 0x44, 0x45, 0x52, 0x98, 0x01, 0x03, 0x8c, 0x01, 0x8b, 0x01, 0x92, 0x01, 0x17, 0x49, 0x4e, 0x56, 0x41, 0x4c, 0x49, 0x44, 0x5f, 0x41, 0x54, 0x54, 0x41, 0x43, 0x48, 0x4d, 0x45, 0x4e, 0x54, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x98, 0x01, 0x04, 0x8c, 0x01, 0x74, ]) _net_proto___parse__python.RegisterType(_SERIALIZED_DESCRIPTOR.tostring()) class MailAttachment(ProtocolBuffer.ProtocolMessage): def __init__(self, contents=None): self.filename_ = "" self.data_ = "" self.has_filename_ = 0 self.has_data_ = 0 if contents is not None: self.MergeFromString(contents) def filename(self): return self.filename_ def set_filename(self, x): self.has_filename_ = 1 self.filename_ = x def clear_filename(self): self.has_filename_ = 0 self.filename_ = "" def has_filename(self): return self.has_filename_ def data(self): return self.data_ def set_data(self, x): self.has_data_ = 1 self.data_ = x def clear_data(self): self.has_data_ = 0 self.data_ = "" def has_data(self): return self.has_data_ def MergeFrom(self, x): assert x is not self if (x.has_filename()): self.set_filename(x.filename()) if (x.has_data()): self.set_data(x.data()) def _CMergeFromString(self, s): _net_proto___parse__python.MergeFromString(self, 'apphosting.MailAttachment', s) def _CEncode(self): return _net_proto___parse__python.Encode(self, 'apphosting.MailAttachment') def _CToASCII(self, output_format): return _net_proto___parse__python.ToASCII(self, 'apphosting.MailAttachment', output_format) def ParseASCII(self, s): _net_proto___parse__python.ParseASCII(self, 'apphosting.MailAttachment', s) def Equals(self, x): if x is self: return 1 if self.has_filename_ != x.has_filename_: return 0 if self.has_filename_ and self.filename_ != x.filename_: return 0 if self.has_data_ != x.has_data_: return 0 if self.has_data_ and self.data_ != x.data_: return 0 return 1 def __eq__(self, other): return (other is not None) and (other.__class__ == self.__class__) and self.Equals(other) def __ne__(self, other): return not (self == other) def IsInitialized(self, debug_strs=None): initialized = 1 if (not self.has_filename_): initialized = 0 if debug_strs is not None: debug_strs.append('Required field: filename not set.') if (not self.has_data_): initialized = 0 if debug_strs is not None: debug_strs.append('Required field: data not set.') return initialized def ByteSize(self): n = 0 n += self.lengthString(len(self.filename_)) n += self.lengthString(len(self.data_)) return n + 2 def Clear(self): self.clear_filename() self.clear_data() def OutputUnchecked(self, out): out.putVarInt32(10) out.putPrefixedString(self.filename_) out.putVarInt32(18) out.putPrefixedString(self.data_) def TryMerge(self, d): while d.avail() > 0: tt = d.getVarInt32() if tt == 10: self.set_filename(d.getPrefixedString()) continue if tt == 18: self.set_data(d.getPrefixedString()) continue if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError d.skipData(tt) def __str__(self, prefix="", printElemNumber=0): res="" if self.has_filename_: res+=prefix+("FileName: %s\n" % self.DebugFormatString(self.filename_)) if self.has_data_: res+=prefix+("Data: %s\n" % self.DebugFormatString(self.data_)) return res kFileName = 1 kData = 2 _TEXT = ( "ErrorCode", "FileName", "Data", ) _TYPES = ( ProtocolBuffer.Encoder.NUMERIC, ProtocolBuffer.Encoder.STRING, ProtocolBuffer.Encoder.STRING, ) _STYLE = """""" _STYLE_CONTENT_TYPE = """""" _SERIALIZED_DESCRIPTOR = array.array('B', [ 0x5a, 0x21, 0x61, 0x70, 0x70, 0x68, 0x6f, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x6d, 0x61, 0x69, 0x6c, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x0a, 0x19, 0x61, 0x70, 0x70, 0x68, 0x6f, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x4d, 0x61, 0x69, 0x6c, 0x41, 0x74, 0x74, 0x61, 0x63, 0x68, 0x6d, 0x65, 0x6e, 0x74, 0x13, 0x1a, 0x08, 0x46, 0x69, 0x6c, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x20, 0x01, 0x28, 0x02, 0x30, 0x09, 0x38, 0x02, 0x14, 0x13, 0x1a, 0x04, 0x44, 0x61, 0x74, 0x61, 0x20, 0x02, 0x28, 0x02, 0x30, 0x09, 0x38, 0x02, 0x14, ]) _net_proto___parse__python.RegisterType(_SERIALIZED_DESCRIPTOR.tostring()) class MailMessage(ProtocolBuffer.ProtocolMessage): def __init__(self, contents=None): self.sender_ = "" self.replyto_ = "" self.to_ = [] self.cc_ = [] self.bcc_ = [] self.subject_ = "" self.textbody_ = "" self.htmlbody_ = "" self.attachment_ = [] self.has_sender_ = 0 self.has_replyto_ = 0 self.has_subject_ = 0 self.has_textbody_ = 0 self.has_htmlbody_ = 0 if contents is not None: self.MergeFromString(contents) def sender(self): return self.sender_ def set_sender(self, x): self.has_sender_ = 1 self.sender_ = x def clear_sender(self): self.has_sender_ = 0 self.sender_ = "" def has_sender(self): return self.has_sender_ def replyto(self): return self.replyto_ def set_replyto(self, x): self.has_replyto_ = 1 self.replyto_ = x def clear_replyto(self): self.has_replyto_ = 0 self.replyto_ = "" def has_replyto(self): return self.has_replyto_ def to_size(self): return len(self.to_) def to_list(self): return self.to_ def to(self, i): return self.to_[i] def set_to(self, i, x): self.to_[i] = x def add_to(self, x): self.to_.append(x) def clear_to(self): self.to_ = [] def cc_size(self): return len(self.cc_) def cc_list(self): return self.cc_ def cc(self, i): return self.cc_[i] def set_cc(self, i, x): self.cc_[i] = x def add_cc(self, x): self.cc_.append(x) def clear_cc(self): self.cc_ = [] def bcc_size(self): return len(self.bcc_) def bcc_list(self): return self.bcc_ def bcc(self, i): return self.bcc_[i] def set_bcc(self, i, x): self.bcc_[i] = x def add_bcc(self, x): self.bcc_.append(x) def clear_bcc(self): self.bcc_ = [] def subject(self): return self.subject_ def set_subject(self, x): self.has_subject_ = 1 self.subject_ = x def clear_subject(self): self.has_subject_ = 0 self.subject_ = "" def has_subject(self): return self.has_subject_ def textbody(self): return self.textbody_ def set_textbody(self, x): self.has_textbody_ = 1 self.textbody_ = x def clear_textbody(self): self.has_textbody_ = 0 self.textbody_ = "" def has_textbody(self): return self.has_textbody_ def htmlbody(self): return self.htmlbody_ def set_htmlbody(self, x): self.has_htmlbody_ = 1 self.htmlbody_ = x def clear_htmlbody(self): self.has_htmlbody_ = 0 self.htmlbody_ = "" def has_htmlbody(self): return self.has_htmlbody_ def attachment_size(self): return len(self.attachment_) def attachment_list(self): return self.attachment_ def attachment(self, i): return self.attachment_[i] def mutable_attachment(self, i): return self.attachment_[i] def add_attachment(self): x = MailAttachment() self.attachment_.append(x) return x def clear_attachment(self): self.attachment_ = [] def MergeFrom(self, x): assert x is not self if (x.has_sender()): self.set_sender(x.sender()) if (x.has_replyto()): self.set_replyto(x.replyto()) for i in xrange(x.to_size()): self.add_to(x.to(i)) for i in xrange(x.cc_size()): self.add_cc(x.cc(i)) for i in xrange(x.bcc_size()): self.add_bcc(x.bcc(i)) if (x.has_subject()): self.set_subject(x.subject()) if (x.has_textbody()): self.set_textbody(x.textbody()) if (x.has_htmlbody()): self.set_htmlbody(x.htmlbody()) for i in xrange(x.attachment_size()): self.add_attachment().CopyFrom(x.attachment(i)) def _CMergeFromString(self, s): _net_proto___parse__python.MergeFromString(self, 'apphosting.MailMessage', s) def _CEncode(self): return _net_proto___parse__python.Encode(self, 'apphosting.MailMessage') def _CToASCII(self, output_format): return _net_proto___parse__python.ToASCII(self, 'apphosting.MailMessage', output_format) def ParseASCII(self, s): _net_proto___parse__python.ParseASCII(self, 'apphosting.MailMessage', s) def Equals(self, x): if x is self: return 1 if self.has_sender_ != x.has_sender_: return 0 if self.has_sender_ and self.sender_ != x.sender_: return 0 if self.has_replyto_ != x.has_replyto_: return 0 if self.has_replyto_ and self.replyto_ != x.replyto_: return 0 if len(self.to_) != len(x.to_): return 0 for e1, e2 in zip(self.to_, x.to_): if e1 != e2: return 0 if len(self.cc_) != len(x.cc_): return 0 for e1, e2 in zip(self.cc_, x.cc_): if e1 != e2: return 0 if len(self.bcc_) != len(x.bcc_): return 0 for e1, e2 in zip(self.bcc_, x.bcc_): if e1 != e2: return 0 if self.has_subject_ != x.has_subject_: return 0 if self.has_subject_ and self.subject_ != x.subject_: return 0 if self.has_textbody_ != x.has_textbody_: return 0 if self.has_textbody_ and self.textbody_ != x.textbody_: return 0 if self.has_htmlbody_ != x.has_htmlbody_: return 0 if self.has_htmlbody_ and self.htmlbody_ != x.htmlbody_: return 0 if len(self.attachment_) != len(x.attachment_): return 0 for e1, e2 in zip(self.attachment_, x.attachment_): if e1 != e2: return 0 return 1 def __eq__(self, other): return (other is not None) and (other.__class__ == self.__class__) and self.Equals(other) def __ne__(self, other): return not (self == other) def IsInitialized(self, debug_strs=None): initialized = 1 if (not self.has_sender_): initialized = 0 if debug_strs is not None: debug_strs.append('Required field: sender not set.') if (not self.has_subject_): initialized = 0 if debug_strs is not None: debug_strs.append('Required field: subject not set.') for i in xrange(len(self.attachment_)): if (not self.attachment_[i].IsInitialized(debug_strs)): initialized=0 return initialized def ByteSize(self): n = 0 n += self.lengthString(len(self.sender_)) if (self.has_replyto_): n += 1 + self.lengthString(len(self.replyto_)) n += 1 * len(self.to_) for i in xrange(len(self.to_)): n += self.lengthString(len(self.to_[i])) n += 1 * len(self.cc_) for i in xrange(len(self.cc_)): n += self.lengthString(len(self.cc_[i])) n += 1 * len(self.bcc_) for i in xrange(len(self.bcc_)): n += self.lengthString(len(self.bcc_[i])) n += self.lengthString(len(self.subject_)) if (self.has_textbody_): n += 1 + self.lengthString(len(self.textbody_)) if (self.has_htmlbody_): n += 1 + self.lengthString(len(self.htmlbody_)) n += 1 * len(self.attachment_) for i in xrange(len(self.attachment_)): n += self.lengthString(self.attachment_[i].ByteSize()) return n + 2 def Clear(self): self.clear_sender() self.clear_replyto() self.clear_to() self.clear_cc() self.clear_bcc() self.clear_subject() self.clear_textbody() self.clear_htmlbody() self.clear_attachment() def OutputUnchecked(self, out): out.putVarInt32(10) out.putPrefixedString(self.sender_) if (self.has_replyto_): out.putVarInt32(18) out.putPrefixedString(self.replyto_) for i in xrange(len(self.to_)): out.putVarInt32(26) out.putPrefixedString(self.to_[i]) for i in xrange(len(self.cc_)): out.putVarInt32(34) out.putPrefixedString(self.cc_[i]) for i in xrange(len(self.bcc_)): out.putVarInt32(42) out.putPrefixedString(self.bcc_[i]) out.putVarInt32(50) out.putPrefixedString(self.subject_) if (self.has_textbody_): out.putVarInt32(58) out.putPrefixedString(self.textbody_) if (self.has_htmlbody_): out.putVarInt32(66) out.putPrefixedString(self.htmlbody_) for i in xrange(len(self.attachment_)): out.putVarInt32(74) out.putVarInt32(self.attachment_[i].ByteSize()) self.attachment_[i].OutputUnchecked(out) def TryMerge(self, d): while d.avail() > 0: tt = d.getVarInt32() if tt == 10: self.set_sender(d.getPrefixedString()) continue if tt == 18: self.set_replyto(d.getPrefixedString()) continue if tt == 26: self.add_to(d.getPrefixedString()) continue if tt == 34: self.add_cc(d.getPrefixedString()) continue if tt == 42: self.add_bcc(d.getPrefixedString()) continue if tt == 50: self.set_subject(d.getPrefixedString()) continue if tt == 58: self.set_textbody(d.getPrefixedString()) continue if tt == 66: self.set_htmlbody(d.getPrefixedString()) continue if tt == 74: length = d.getVarInt32() tmp = ProtocolBuffer.Decoder(d.buffer(), d.pos(), d.pos() + length) d.skip(length) self.add_attachment().TryMerge(tmp) continue if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError d.skipData(tt) def __str__(self, prefix="", printElemNumber=0): res="" if self.has_sender_: res+=prefix+("Sender: %s\n" % self.DebugFormatString(self.sender_)) if self.has_replyto_: res+=prefix+("ReplyTo: %s\n" % self.DebugFormatString(self.replyto_)) cnt=0 for e in self.to_: elm="" if printElemNumber: elm="(%d)" % cnt res+=prefix+("To%s: %s\n" % (elm, self.DebugFormatString(e))) cnt+=1 cnt=0 for e in self.cc_: elm="" if printElemNumber: elm="(%d)" % cnt res+=prefix+("Cc%s: %s\n" % (elm, self.DebugFormatString(e))) cnt+=1 cnt=0 for e in self.bcc_: elm="" if printElemNumber: elm="(%d)" % cnt res+=prefix+("Bcc%s: %s\n" % (elm, self.DebugFormatString(e))) cnt+=1 if self.has_subject_: res+=prefix+("Subject: %s\n" % self.DebugFormatString(self.subject_)) if self.has_textbody_: res+=prefix+("TextBody: %s\n" % self.DebugFormatString(self.textbody_)) if self.has_htmlbody_: res+=prefix+("HtmlBody: %s\n" % self.DebugFormatString(self.htmlbody_)) cnt=0 for e in self.attachment_: elm="" if printElemNumber: elm="(%d)" % cnt res+=prefix+("Attachment%s <\n" % elm) res+=e.__str__(prefix + " ", printElemNumber) res+=prefix+">\n" cnt+=1 return res kSender = 1 kReplyTo = 2 kTo = 3 kCc = 4 kBcc = 5 kSubject = 6 kTextBody = 7 kHtmlBody = 8 kAttachment = 9 _TEXT = ( "ErrorCode", "Sender", "ReplyTo", "To", "Cc", "Bcc", "Subject", "TextBody", "HtmlBody", "Attachment", ) _TYPES = ( ProtocolBuffer.Encoder.NUMERIC, ProtocolBuffer.Encoder.STRING, ProtocolBuffer.Encoder.STRING, ProtocolBuffer.Encoder.STRING, ProtocolBuffer.Encoder.STRING, ProtocolBuffer.Encoder.STRING, ProtocolBuffer.Encoder.STRING, ProtocolBuffer.Encoder.STRING, ProtocolBuffer.Encoder.STRING, ProtocolBuffer.Encoder.STRING, ) _STYLE = """""" _STYLE_CONTENT_TYPE = """""" _SERIALIZED_DESCRIPTOR = array.array('B', [ 0x5a, 0x21, 0x61, 0x70, 0x70, 0x68, 0x6f, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x6d, 0x61, 0x69, 0x6c, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x0a, 0x16, 0x61, 0x70, 0x70, 0x68, 0x6f, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x4d, 0x61, 0x69, 0x6c, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x13, 0x1a, 0x06, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x20, 0x01, 0x28, 0x02, 0x30, 0x09, 0x38, 0x02, 0x14, 0x13, 0x1a, 0x07, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x54, 0x6f, 0x20, 0x02, 0x28, 0x02, 0x30, 0x09, 0x38, 0x01, 0x14, 0x13, 0x1a, 0x02, 0x54, 0x6f, 0x20, 0x03, 0x28, 0x02, 0x30, 0x09, 0x38, 0x03, 0x14, 0x13, 0x1a, 0x02, 0x43, 0x63, 0x20, 0x04, 0x28, 0x02, 0x30, 0x09, 0x38, 0x03, 0x14, 0x13, 0x1a, 0x03, 0x42, 0x63, 0x63, 0x20, 0x05, 0x28, 0x02, 0x30, 0x09, 0x38, 0x03, 0x14, 0x13, 0x1a, 0x07, 0x53, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x20, 0x06, 0x28, 0x02, 0x30, 0x09, 0x38, 0x02, 0x14, 0x13, 0x1a, 0x08, 0x54, 0x65, 0x78, 0x74, 0x42, 0x6f, 0x64, 0x79, 0x20, 0x07, 0x28, 0x02, 0x30, 0x09, 0x38, 0x01, 0x14, 0x13, 0x1a, 0x08, 0x48, 0x74, 0x6d, 0x6c, 0x42, 0x6f, 0x64, 0x79, 0x20, 0x08, 0x28, 0x02, 0x30, 0x09, 0x38, 0x01, 0x14, 0x13, 0x1a, 0x0a, 0x41, 0x74, 0x74, 0x61, 0x63, 0x68, 0x6d, 0x65, 0x6e, 0x74, 0x20, 0x09, 0x28, 0x02, 0x30, 0x0b, 0x38, 0x03, 0x4a, 0x19, 0x61, 0x70, 0x70, 0x68, 0x6f, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x4d, 0x61, 0x69, 0x6c, 0x41, 0x74, 0x74, 0x61, 0x63, 0x68, 0x6d, 0x65, 0x6e, 0x74, 0x14, ]) _net_proto___parse__python.RegisterType(_SERIALIZED_DESCRIPTOR.tostring()) class _MailService_ClientStub(_client_stub_base_class): """Makes Stubby RPC calls to a MailService server.""" __slots__ = ( '_protorpc_Send', '_full_name_Send', '_protorpc_SendToAdmins', '_full_name_SendToAdmins', ) def __init__(self, rpc_stub_parameters): rpc_internals.StubbyRPCBaseStub.__init__(self, 'MailService', rpc_stub_parameters) self._protorpc_Send = pywraprpc.RPC() self._full_name_Send = self._stub.GetFullMethodName( 'Send') self._protorpc_SendToAdmins = pywraprpc.RPC() self._full_name_SendToAdmins = self._stub.GetFullMethodName( 'SendToAdmins') def Send(self, request, rpc=None, callback=None): """Make a Send RPC call. Args: request: a MailMessage instance. rpc: Optional RPC instance to use for the call. callback: Optional callback. Will be called as callback(rpc, result). If None, the call synchronous. Returns: The VoidProto if callback is None. Otherwise, returns None. """ return self._MakeCall(rpc, self._full_name_Send, 'Send', request, VoidProto, callback, self._protorpc_Send) def SendToAdmins(self, request, rpc=None, callback=None): """Make a SendToAdmins RPC call. Args: request: a MailMessage instance. rpc: Optional RPC instance to use for the call. callback: Optional callback. Will be called as callback(rpc, result). If None, the call synchronous. Returns: The VoidProto if callback is None. Otherwise, returns None. """ return self._MakeCall(rpc, self._full_name_SendToAdmins, 'SendToAdmins', request, VoidProto, callback, self._protorpc_SendToAdmins) class MailService(object): """Base class for MailService Stubby servers.""" def __init__(self): raise NotImplementedError('Server stubs are not supported yet. ' 'Use MailService.NewStub(...) to ' 'create a client stub') def NewStub(rpc_stub_parameters): """Creates a new MailService Stubby client stub. Args: rpc_stub_parameters: an RPC_StubParameter instance. """ if _client_stub_base_class is object: raise RuntimeError('Add //net/rpc/python as a dependency to use Stubby') return _MailService_ClientStub(rpc_stub_parameters) NewStub = staticmethod(NewStub) __all__ = ['MailServiceError','MailAttachment','MailMessage']