def run_requests(self, requests): rs = [] for theRequest in requests: method = theRequest["method"] url = self.request.url_root.rstrip("/") + theRequest["url"] if method == "GET": rs.append(grequests.get(url)) if method == "DELETE": rs.append(grequests.delete(url)) if method == "OPTIONS": rs.append(grequests.options(url)) if method == "POST": rs.append(grequests.post(url, json=theRequest)) if method == "PATCH": rs.append(grequests.patch(url, json=theRequest)) return grequests.map(rs)
def options(self, url, **kwargs): kwargs['auth'] = self.auth return grequests.map([grequests.options(url, **kwargs)])[0]
def options(self, url, **kwargs): """HTTP OPTIONS Method.""" kwargs['auth'] = self.auth req = grequests.options(url, **kwargs) return self._run(req)