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)))
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()
def api_url(self): '''return the api url of this request''' return pathjoin(Request.path, self.id, url=self.bin.api_url)
def api_url(self): '''return the api url of self''' return pathjoin(Bin.path, self.name, url=self.service.url)
def url(self): '''return the url of this bin''' return pathjoin(self.name, url=self.service.url)
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)