Esempio n. 1
0
 def get(self):
     self.response = _Response(urlopen(self.uri))
     if self._is_raw:
         return self
     else:
         content_type = self.response.headers.gettype()
         return ConverterRegistry.marshaller_for(content_type).\
             unmarshal(self.response.body)
Esempio n. 2
0
 def post(self, content):
     encoded_content = urlencode({'content':
         ConverterRegistry.marshaller_for(self._content_type).\
             marshal(content)})
     response = urlopen(self.uri, encoded_content)
     if response.code == 201: # created
         location = response.headers.getheaders('Location')[0]
         return Restfulie.at(location).get()
 def post(self, content):
     encoded_content = urlencode({'content':
         ConverterRegistry.marshaller_for(self._content_type).\
             marshal(content)})
     urlopen(self.uri, encoded_content)