def request_wrapper(method, url, **kwargs): kwargs['allow_redirects'] = True resp = request(method, url, **kwargs) # print "RESP: (%s, %s)" % (resp.status, resp.reason) # print resp # print resp.__dict__ # print resp.getheaders() # print resp.getheader('location') return resp
def discover(self): """ Will use the baseURL and query the remote server to auto determine the resources and the field validation for each resource """ # Get the global headers and set any extra headers headers = self.headers.copy() headers.update(self.auth.headers) data = request('GET', self.url, headers=headers).read() resources = json.loads(data) for res in resources: self.resource(res)