def _get(self, name=None, header_list=()): header_list = list(header_list) if name is not None: header_list = [headers.Name(name)] + header_list max_length = self.remote_info.max_packet_length request = requests.Get() response = self._send_headers(request, header_list, max_length) yield response if not isinstance(response, responses.Continue) and \ not isinstance(response, responses.Success): return # Retrieve the file data. file_data = [] request = requests.Get_Final() while isinstance(response, responses.Continue): self.socket.sendall(request.encode()) response = self.response_handler.decode(self.socket) yield response
def get_links(qry): requests = async.compile(qry) results = requests.Get() for result in results: if title = search: found = True
def get(self, name = None, header_list = ()): """get(self, name = None, header_list = ()) Requests the specified file from the server's current directory for the session. If successful, returns a tuple containing a list of responses received during the operation and the file data received. If unsuccessful, a single response object is returned. Additional headers can be sent by passing a sequence as the header_list keyword argument. These will be sent after the name information. """ header_list = list(header_list) if name is not None: header_list = [headers.Name(name)] + header_list max_length = self.remote_info.max_packet_length request = requests.Get() response = self._send_headers(request, header_list, max_length) if not isinstance(response, responses.Continue) and \ not isinstance(response, responses.Success): return response # Retrieve the file data. returned_headers = [] file_data = [] request = requests.Get_Final() while isinstance(response, responses.Continue): returned_headers += response.header_data self.con.send(request.encode()) response = self.response_handler.decode(self.con) if not isinstance(response, responses.Success): return response returned_headers += response.header_data return self._collect_parts(returned_headers)
import requests,pprint payload = { "action":"list_thing", "id": 6 } response = requests.Get('http://localhost/api/things/manage/', data=payload) pprint.pprint(response.json())