Exemplo n.º 1
0
 def requests(self):
     '''return accumulated requests to this bin'''
     path = pathjoin(self.path, self.name, Request.path)
     response = self.service.send(SRequest('GET', path))
     # a bin behaves as a push-down store --- better to return the requests
     # in order of appearance
     return list(reversed(Request.from_response(response, bin=self)))
Exemplo n.º 2
0
 def __call__(self, url, auth=None):
     '''return a prepared request to be sent'''
     return requests.Request(self.method, pathjoin(self.path, url=url), auth=auth,
         headers=self.headers, data=self.data).prepare()
Exemplo n.º 3
0
 def api_url(self):
     '''return the api url of this request'''
     return pathjoin(Request.path, self.id, url=self.bin.api_url)
Exemplo n.º 4
0
 def api_url(self):
     '''return the api url of self'''
     return pathjoin(Bin.path, self.name, url=self.service.url)
Exemplo n.º 5
0
 def url(self):
     '''return the url of this bin'''
     return pathjoin(self.name, url=self.service.url)
Exemplo n.º 6
0
 def get(cls, name, service=Service()):
     '''fetch given bin from the service'''
     path = pathjoin(cls.path, name)
     response = service.send(SRequest('GET', path))
     return cls.from_response(response, service=service)