thirdparty/google_appengine/google/appengine/api/urlfetch_service_pb.py
changeset 2309 be1b94099f2d
parent 2273 e4cb9c53db3e
child 2864 2e0b0af889be
equal deleted inserted replaced
2307:81c128f487e6 2309:be1b94099f2d
   215   url_ = ""
   215   url_ = ""
   216   has_payload_ = 0
   216   has_payload_ = 0
   217   payload_ = ""
   217   payload_ = ""
   218   has_followredirects_ = 0
   218   has_followredirects_ = 0
   219   followredirects_ = 1
   219   followredirects_ = 1
       
   220   has_deadline_ = 0
       
   221   deadline_ = 0.0
   220 
   222 
   221   def __init__(self, contents=None):
   223   def __init__(self, contents=None):
   222     self.header_ = []
   224     self.header_ = []
   223     if contents is not None: self.MergeFromString(contents)
   225     if contents is not None: self.MergeFromString(contents)
   224 
   226 
   287     if self.has_followredirects_:
   289     if self.has_followredirects_:
   288       self.has_followredirects_ = 0
   290       self.has_followredirects_ = 0
   289       self.followredirects_ = 1
   291       self.followredirects_ = 1
   290 
   292 
   291   def has_followredirects(self): return self.has_followredirects_
   293   def has_followredirects(self): return self.has_followredirects_
       
   294 
       
   295   def deadline(self): return self.deadline_
       
   296 
       
   297   def set_deadline(self, x):
       
   298     self.has_deadline_ = 1
       
   299     self.deadline_ = x
       
   300 
       
   301   def clear_deadline(self):
       
   302     if self.has_deadline_:
       
   303       self.has_deadline_ = 0
       
   304       self.deadline_ = 0.0
       
   305 
       
   306   def has_deadline(self): return self.has_deadline_
   292 
   307 
   293 
   308 
   294   def MergeFrom(self, x):
   309   def MergeFrom(self, x):
   295     assert x is not self
   310     assert x is not self
   296     if (x.has_method()): self.set_method(x.method())
   311     if (x.has_method()): self.set_method(x.method())
   297     if (x.has_url()): self.set_url(x.url())
   312     if (x.has_url()): self.set_url(x.url())
   298     for i in xrange(x.header_size()): self.add_header().CopyFrom(x.header(i))
   313     for i in xrange(x.header_size()): self.add_header().CopyFrom(x.header(i))
   299     if (x.has_payload()): self.set_payload(x.payload())
   314     if (x.has_payload()): self.set_payload(x.payload())
   300     if (x.has_followredirects()): self.set_followredirects(x.followredirects())
   315     if (x.has_followredirects()): self.set_followredirects(x.followredirects())
       
   316     if (x.has_deadline()): self.set_deadline(x.deadline())
   301 
   317 
   302   def Equals(self, x):
   318   def Equals(self, x):
   303     if x is self: return 1
   319     if x is self: return 1
   304     if self.has_method_ != x.has_method_: return 0
   320     if self.has_method_ != x.has_method_: return 0
   305     if self.has_method_ and self.method_ != x.method_: return 0
   321     if self.has_method_ and self.method_ != x.method_: return 0
   310       if e1 != e2: return 0
   326       if e1 != e2: return 0
   311     if self.has_payload_ != x.has_payload_: return 0
   327     if self.has_payload_ != x.has_payload_: return 0
   312     if self.has_payload_ and self.payload_ != x.payload_: return 0
   328     if self.has_payload_ and self.payload_ != x.payload_: return 0
   313     if self.has_followredirects_ != x.has_followredirects_: return 0
   329     if self.has_followredirects_ != x.has_followredirects_: return 0
   314     if self.has_followredirects_ and self.followredirects_ != x.followredirects_: return 0
   330     if self.has_followredirects_ and self.followredirects_ != x.followredirects_: return 0
       
   331     if self.has_deadline_ != x.has_deadline_: return 0
       
   332     if self.has_deadline_ and self.deadline_ != x.deadline_: return 0
   315     return 1
   333     return 1
   316 
   334 
   317   def IsInitialized(self, debug_strs=None):
   335   def IsInitialized(self, debug_strs=None):
   318     initialized = 1
   336     initialized = 1
   319     if (not self.has_method_):
   337     if (not self.has_method_):
   334     n += self.lengthString(len(self.url_))
   352     n += self.lengthString(len(self.url_))
   335     n += 2 * len(self.header_)
   353     n += 2 * len(self.header_)
   336     for i in xrange(len(self.header_)): n += self.header_[i].ByteSize()
   354     for i in xrange(len(self.header_)): n += self.header_[i].ByteSize()
   337     if (self.has_payload_): n += 1 + self.lengthString(len(self.payload_))
   355     if (self.has_payload_): n += 1 + self.lengthString(len(self.payload_))
   338     if (self.has_followredirects_): n += 2
   356     if (self.has_followredirects_): n += 2
       
   357     if (self.has_deadline_): n += 9
   339     return n + 2
   358     return n + 2
   340 
   359 
   341   def Clear(self):
   360   def Clear(self):
   342     self.clear_method()
   361     self.clear_method()
   343     self.clear_url()
   362     self.clear_url()
   344     self.clear_header()
   363     self.clear_header()
   345     self.clear_payload()
   364     self.clear_payload()
   346     self.clear_followredirects()
   365     self.clear_followredirects()
       
   366     self.clear_deadline()
   347 
   367 
   348   def OutputUnchecked(self, out):
   368   def OutputUnchecked(self, out):
   349     out.putVarInt32(8)
   369     out.putVarInt32(8)
   350     out.putVarInt32(self.method_)
   370     out.putVarInt32(self.method_)
   351     out.putVarInt32(18)
   371     out.putVarInt32(18)
   358       out.putVarInt32(50)
   378       out.putVarInt32(50)
   359       out.putPrefixedString(self.payload_)
   379       out.putPrefixedString(self.payload_)
   360     if (self.has_followredirects_):
   380     if (self.has_followredirects_):
   361       out.putVarInt32(56)
   381       out.putVarInt32(56)
   362       out.putBoolean(self.followredirects_)
   382       out.putBoolean(self.followredirects_)
       
   383     if (self.has_deadline_):
       
   384       out.putVarInt32(65)
       
   385       out.putDouble(self.deadline_)
   363 
   386 
   364   def TryMerge(self, d):
   387   def TryMerge(self, d):
   365     while d.avail() > 0:
   388     while d.avail() > 0:
   366       tt = d.getVarInt32()
   389       tt = d.getVarInt32()
   367       if tt == 8:
   390       if tt == 8:
   376       if tt == 50:
   399       if tt == 50:
   377         self.set_payload(d.getPrefixedString())
   400         self.set_payload(d.getPrefixedString())
   378         continue
   401         continue
   379       if tt == 56:
   402       if tt == 56:
   380         self.set_followredirects(d.getBoolean())
   403         self.set_followredirects(d.getBoolean())
       
   404         continue
       
   405       if tt == 65:
       
   406         self.set_deadline(d.getDouble())
   381         continue
   407         continue
   382       if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError
   408       if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError
   383       d.skipData(tt)
   409       d.skipData(tt)
   384 
   410 
   385 
   411 
   395       res+=e.__str__(prefix + "  ", printElemNumber)
   421       res+=e.__str__(prefix + "  ", printElemNumber)
   396       res+=prefix+"}\n"
   422       res+=prefix+"}\n"
   397       cnt+=1
   423       cnt+=1
   398     if self.has_payload_: res+=prefix+("Payload: %s\n" % self.DebugFormatString(self.payload_))
   424     if self.has_payload_: res+=prefix+("Payload: %s\n" % self.DebugFormatString(self.payload_))
   399     if self.has_followredirects_: res+=prefix+("FollowRedirects: %s\n" % self.DebugFormatBool(self.followredirects_))
   425     if self.has_followredirects_: res+=prefix+("FollowRedirects: %s\n" % self.DebugFormatBool(self.followredirects_))
       
   426     if self.has_deadline_: res+=prefix+("Deadline: %s\n" % self.DebugFormat(self.deadline_))
   400     return res
   427     return res
   401 
   428 
   402   kMethod = 1
   429   kMethod = 1
   403   kUrl = 2
   430   kUrl = 2
   404   kHeaderGroup = 3
   431   kHeaderGroup = 3
   405   kHeaderKey = 4
   432   kHeaderKey = 4
   406   kHeaderValue = 5
   433   kHeaderValue = 5
   407   kPayload = 6
   434   kPayload = 6
   408   kFollowRedirects = 7
   435   kFollowRedirects = 7
       
   436   kDeadline = 8
   409 
   437 
   410   _TEXT = (
   438   _TEXT = (
   411    "ErrorCode",
   439    "ErrorCode",
   412    "Method",
   440    "Method",
   413    "Url",
   441    "Url",
   414    "Header",
   442    "Header",
   415    "Key",
   443    "Key",
   416    "Value",
   444    "Value",
   417    "Payload",
   445    "Payload",
   418    "FollowRedirects",
   446    "FollowRedirects",
       
   447    "Deadline",
   419   )
   448   )
   420 
   449 
   421   _TYPES = (
   450   _TYPES = (
   422    ProtocolBuffer.Encoder.NUMERIC,
   451    ProtocolBuffer.Encoder.NUMERIC,
   423    ProtocolBuffer.Encoder.NUMERIC,
   452    ProtocolBuffer.Encoder.NUMERIC,
   431    ProtocolBuffer.Encoder.STRING,
   460    ProtocolBuffer.Encoder.STRING,
   432 
   461 
   433    ProtocolBuffer.Encoder.STRING,
   462    ProtocolBuffer.Encoder.STRING,
   434 
   463 
   435    ProtocolBuffer.Encoder.NUMERIC,
   464    ProtocolBuffer.Encoder.NUMERIC,
       
   465 
       
   466    ProtocolBuffer.Encoder.DOUBLE,
   436 
   467 
   437   )
   468   )
   438 
   469 
   439   _STYLE = """"""
   470   _STYLE = """"""
   440   _STYLE_CONTENT_TYPE = """"""
   471   _STYLE_CONTENT_TYPE = """"""
   540   content_ = ""
   571   content_ = ""
   541   has_statuscode_ = 0
   572   has_statuscode_ = 0
   542   statuscode_ = 0
   573   statuscode_ = 0
   543   has_contentwastruncated_ = 0
   574   has_contentwastruncated_ = 0
   544   contentwastruncated_ = 0
   575   contentwastruncated_ = 0
       
   576   has_externalbytessent_ = 0
       
   577   externalbytessent_ = 0
       
   578   has_externalbytesreceived_ = 0
       
   579   externalbytesreceived_ = 0
   545 
   580 
   546   def __init__(self, contents=None):
   581   def __init__(self, contents=None):
   547     self.header_ = []
   582     self.header_ = []
   548     if contents is not None: self.MergeFromString(contents)
   583     if contents is not None: self.MergeFromString(contents)
   549 
   584 
   599     if self.has_contentwastruncated_:
   634     if self.has_contentwastruncated_:
   600       self.has_contentwastruncated_ = 0
   635       self.has_contentwastruncated_ = 0
   601       self.contentwastruncated_ = 0
   636       self.contentwastruncated_ = 0
   602 
   637 
   603   def has_contentwastruncated(self): return self.has_contentwastruncated_
   638   def has_contentwastruncated(self): return self.has_contentwastruncated_
       
   639 
       
   640   def externalbytessent(self): return self.externalbytessent_
       
   641 
       
   642   def set_externalbytessent(self, x):
       
   643     self.has_externalbytessent_ = 1
       
   644     self.externalbytessent_ = x
       
   645 
       
   646   def clear_externalbytessent(self):
       
   647     if self.has_externalbytessent_:
       
   648       self.has_externalbytessent_ = 0
       
   649       self.externalbytessent_ = 0
       
   650 
       
   651   def has_externalbytessent(self): return self.has_externalbytessent_
       
   652 
       
   653   def externalbytesreceived(self): return self.externalbytesreceived_
       
   654 
       
   655   def set_externalbytesreceived(self, x):
       
   656     self.has_externalbytesreceived_ = 1
       
   657     self.externalbytesreceived_ = x
       
   658 
       
   659   def clear_externalbytesreceived(self):
       
   660     if self.has_externalbytesreceived_:
       
   661       self.has_externalbytesreceived_ = 0
       
   662       self.externalbytesreceived_ = 0
       
   663 
       
   664   def has_externalbytesreceived(self): return self.has_externalbytesreceived_
   604 
   665 
   605 
   666 
   606   def MergeFrom(self, x):
   667   def MergeFrom(self, x):
   607     assert x is not self
   668     assert x is not self
   608     if (x.has_content()): self.set_content(x.content())
   669     if (x.has_content()): self.set_content(x.content())
   609     if (x.has_statuscode()): self.set_statuscode(x.statuscode())
   670     if (x.has_statuscode()): self.set_statuscode(x.statuscode())
   610     for i in xrange(x.header_size()): self.add_header().CopyFrom(x.header(i))
   671     for i in xrange(x.header_size()): self.add_header().CopyFrom(x.header(i))
   611     if (x.has_contentwastruncated()): self.set_contentwastruncated(x.contentwastruncated())
   672     if (x.has_contentwastruncated()): self.set_contentwastruncated(x.contentwastruncated())
       
   673     if (x.has_externalbytessent()): self.set_externalbytessent(x.externalbytessent())
       
   674     if (x.has_externalbytesreceived()): self.set_externalbytesreceived(x.externalbytesreceived())
   612 
   675 
   613   def Equals(self, x):
   676   def Equals(self, x):
   614     if x is self: return 1
   677     if x is self: return 1
   615     if self.has_content_ != x.has_content_: return 0
   678     if self.has_content_ != x.has_content_: return 0
   616     if self.has_content_ and self.content_ != x.content_: return 0
   679     if self.has_content_ and self.content_ != x.content_: return 0
   619     if len(self.header_) != len(x.header_): return 0
   682     if len(self.header_) != len(x.header_): return 0
   620     for e1, e2 in zip(self.header_, x.header_):
   683     for e1, e2 in zip(self.header_, x.header_):
   621       if e1 != e2: return 0
   684       if e1 != e2: return 0
   622     if self.has_contentwastruncated_ != x.has_contentwastruncated_: return 0
   685     if self.has_contentwastruncated_ != x.has_contentwastruncated_: return 0
   623     if self.has_contentwastruncated_ and self.contentwastruncated_ != x.contentwastruncated_: return 0
   686     if self.has_contentwastruncated_ and self.contentwastruncated_ != x.contentwastruncated_: return 0
       
   687     if self.has_externalbytessent_ != x.has_externalbytessent_: return 0
       
   688     if self.has_externalbytessent_ and self.externalbytessent_ != x.externalbytessent_: return 0
       
   689     if self.has_externalbytesreceived_ != x.has_externalbytesreceived_: return 0
       
   690     if self.has_externalbytesreceived_ and self.externalbytesreceived_ != x.externalbytesreceived_: return 0
   624     return 1
   691     return 1
   625 
   692 
   626   def IsInitialized(self, debug_strs=None):
   693   def IsInitialized(self, debug_strs=None):
   627     initialized = 1
   694     initialized = 1
   628     if (not self.has_statuscode_):
   695     if (not self.has_statuscode_):
   638     if (self.has_content_): n += 1 + self.lengthString(len(self.content_))
   705     if (self.has_content_): n += 1 + self.lengthString(len(self.content_))
   639     n += self.lengthVarInt64(self.statuscode_)
   706     n += self.lengthVarInt64(self.statuscode_)
   640     n += 2 * len(self.header_)
   707     n += 2 * len(self.header_)
   641     for i in xrange(len(self.header_)): n += self.header_[i].ByteSize()
   708     for i in xrange(len(self.header_)): n += self.header_[i].ByteSize()
   642     if (self.has_contentwastruncated_): n += 2
   709     if (self.has_contentwastruncated_): n += 2
       
   710     if (self.has_externalbytessent_): n += 1 + self.lengthVarInt64(self.externalbytessent_)
       
   711     if (self.has_externalbytesreceived_): n += 1 + self.lengthVarInt64(self.externalbytesreceived_)
   643     return n + 1
   712     return n + 1
   644 
   713 
   645   def Clear(self):
   714   def Clear(self):
   646     self.clear_content()
   715     self.clear_content()
   647     self.clear_statuscode()
   716     self.clear_statuscode()
   648     self.clear_header()
   717     self.clear_header()
   649     self.clear_contentwastruncated()
   718     self.clear_contentwastruncated()
       
   719     self.clear_externalbytessent()
       
   720     self.clear_externalbytesreceived()
   650 
   721 
   651   def OutputUnchecked(self, out):
   722   def OutputUnchecked(self, out):
   652     if (self.has_content_):
   723     if (self.has_content_):
   653       out.putVarInt32(10)
   724       out.putVarInt32(10)
   654       out.putPrefixedString(self.content_)
   725       out.putPrefixedString(self.content_)
   659       self.header_[i].OutputUnchecked(out)
   730       self.header_[i].OutputUnchecked(out)
   660       out.putVarInt32(28)
   731       out.putVarInt32(28)
   661     if (self.has_contentwastruncated_):
   732     if (self.has_contentwastruncated_):
   662       out.putVarInt32(48)
   733       out.putVarInt32(48)
   663       out.putBoolean(self.contentwastruncated_)
   734       out.putBoolean(self.contentwastruncated_)
       
   735     if (self.has_externalbytessent_):
       
   736       out.putVarInt32(56)
       
   737       out.putVarInt64(self.externalbytessent_)
       
   738     if (self.has_externalbytesreceived_):
       
   739       out.putVarInt32(64)
       
   740       out.putVarInt64(self.externalbytesreceived_)
   664 
   741 
   665   def TryMerge(self, d):
   742   def TryMerge(self, d):
   666     while d.avail() > 0:
   743     while d.avail() > 0:
   667       tt = d.getVarInt32()
   744       tt = d.getVarInt32()
   668       if tt == 10:
   745       if tt == 10:
   674       if tt == 27:
   751       if tt == 27:
   675         self.add_header().TryMerge(d)
   752         self.add_header().TryMerge(d)
   676         continue
   753         continue
   677       if tt == 48:
   754       if tt == 48:
   678         self.set_contentwastruncated(d.getBoolean())
   755         self.set_contentwastruncated(d.getBoolean())
       
   756         continue
       
   757       if tt == 56:
       
   758         self.set_externalbytessent(d.getVarInt64())
       
   759         continue
       
   760       if tt == 64:
       
   761         self.set_externalbytesreceived(d.getVarInt64())
   679         continue
   762         continue
   680       if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError
   763       if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError
   681       d.skipData(tt)
   764       d.skipData(tt)
   682 
   765 
   683 
   766 
   692       res+=prefix+("Header%s {\n" % elm)
   775       res+=prefix+("Header%s {\n" % elm)
   693       res+=e.__str__(prefix + "  ", printElemNumber)
   776       res+=e.__str__(prefix + "  ", printElemNumber)
   694       res+=prefix+"}\n"
   777       res+=prefix+"}\n"
   695       cnt+=1
   778       cnt+=1
   696     if self.has_contentwastruncated_: res+=prefix+("ContentWasTruncated: %s\n" % self.DebugFormatBool(self.contentwastruncated_))
   779     if self.has_contentwastruncated_: res+=prefix+("ContentWasTruncated: %s\n" % self.DebugFormatBool(self.contentwastruncated_))
       
   780     if self.has_externalbytessent_: res+=prefix+("ExternalBytesSent: %s\n" % self.DebugFormatInt64(self.externalbytessent_))
       
   781     if self.has_externalbytesreceived_: res+=prefix+("ExternalBytesReceived: %s\n" % self.DebugFormatInt64(self.externalbytesreceived_))
   697     return res
   782     return res
   698 
   783 
   699   kContent = 1
   784   kContent = 1
   700   kStatusCode = 2
   785   kStatusCode = 2
   701   kHeaderGroup = 3
   786   kHeaderGroup = 3
   702   kHeaderKey = 4
   787   kHeaderKey = 4
   703   kHeaderValue = 5
   788   kHeaderValue = 5
   704   kContentWasTruncated = 6
   789   kContentWasTruncated = 6
       
   790   kExternalBytesSent = 7
       
   791   kExternalBytesReceived = 8
   705 
   792 
   706   _TEXT = (
   793   _TEXT = (
   707    "ErrorCode",
   794    "ErrorCode",
   708    "Content",
   795    "Content",
   709    "StatusCode",
   796    "StatusCode",
   710    "Header",
   797    "Header",
   711    "Key",
   798    "Key",
   712    "Value",
   799    "Value",
   713    "ContentWasTruncated",
   800    "ContentWasTruncated",
       
   801    "ExternalBytesSent",
       
   802    "ExternalBytesReceived",
   714   )
   803   )
   715 
   804 
   716   _TYPES = (
   805   _TYPES = (
   717    ProtocolBuffer.Encoder.NUMERIC,
   806    ProtocolBuffer.Encoder.NUMERIC,
   718    ProtocolBuffer.Encoder.STRING,
   807    ProtocolBuffer.Encoder.STRING,
   725 
   814 
   726    ProtocolBuffer.Encoder.STRING,
   815    ProtocolBuffer.Encoder.STRING,
   727 
   816 
   728    ProtocolBuffer.Encoder.NUMERIC,
   817    ProtocolBuffer.Encoder.NUMERIC,
   729 
   818 
       
   819    ProtocolBuffer.Encoder.NUMERIC,
       
   820 
       
   821    ProtocolBuffer.Encoder.NUMERIC,
       
   822 
   730   )
   823   )
   731 
   824 
   732   _STYLE = """"""
   825   _STYLE = """"""
   733   _STYLE_CONTENT_TYPE = """"""
   826   _STYLE_CONTENT_TYPE = """"""
   734 
   827