Make a HTTP Post request to the server 'control' endpoint.
510287
def MakeRequest(self, data):
    """"""
    stats_collector_instance.Get().IncrementCounter("grr_client_sent_bytes",
                                                    len(data))

    # Verify the response is as it should be from the control endpoint.
    response = self.http_manager.OpenServerEndpoint(
        path="control?api=%s" % config.CONFIG["Network.api"],
        verify_cb=self.VerifyServerControlResponse,
        data=data,
        headers={"Content-Type": "binary/octet-stream"})

    if response.code == 406:
      self.InitiateEnrolment()
      return response

    if response.code == 200:
      stats_collector_instance.Get().IncrementCounter(
          "grr_client_received_bytes", len(response.data))
      return response

    # An unspecified error occured.
    return response
827454
def _make_request(self, method, endpoint, **kwargs):
        
        if isinstance(kwargs.get('file_type'), string_types):
            file_type = kwargs['file_type'].lower()
        else:
            file_type = 'json'
        params = kwargs.get('params')

        data = kwargs.get('data', kwargs.get('json', None))
        url = '{}/{}'.format(self.api_url, endpoint)
        self._validate_request(endpoint, file_type, data, params)

        if method == 'get':
            stream = kwargs.get('stream', False)
            url = '{}.{}'.format(url, file_type)
            r = self.session.get(url, params=params, stream=stream)

        elif method == 'post':
            r = self.session.post(url=url, json=data, params=params)

        elif method == 'put':
            r = self.session.put(url=url, json=data, params=params)

        elif method == 'patch':
            r = self.session.patch(url=url, json=data, params=params)

        elif method == 'delete':
            r = self.session.delete(url=url, params=params)

        else:
            raise ClientException("Non-supported HTTP method: {}".format(method))

        return self._validate_response(r)
864606
def fetch(self, endpoint, data = None):
        
        payload = {
            "lastServerChangeId": "-1",
            "csrf": self.__csrf,
            "apiClient": "WEB"
        }
        if data is not None:
            payload.update(data)

        return self.post(endpoint, payload)
973672
def post_json(endpoint, payload)
      s = payload.to_json
      uri = URI(endpoint)
      http = Net::HTTP.new(uri.host, uri.port)
      req = Net::HTTP::Post.new(uri.path, 'Content-Type' => 'application/json')
      req.body = s
      begin
        res = http.request(req)
      rescue StandardError => e
        Spectator.logger.info("Cause #{e.cause} - msg=#{e.message}")
        return 400
      end

      res.value
    end
308098
def _post(self, url, data={}):
        """"""
        r = requests.post(self._api_prefix + url,
            data=json.dumps(data),
            headers=self.headers,
            auth=self.auth,
            allow_redirects=False,
        )
        return self._action(r)
692655
def post(self, content, endpoint=''):
        '''
        
        '''
        url = self.url(endpoint)
        post_content = json.dumps(content).encode('utf-8')
        headers = {'Content-Type': 'application/json'}
        request = Request(url, post_content, headers)

        response = urlopen(request)

        return json.loads(response.read().decode('utf-8'))
1081796
def post(self, path, payload):
        """"""
        body = json.dumps(payload)
        return self._request(path, 'POST', body)
528211
def handleFlaskPostRequest(flaskRequest, endpoint):
    
    if flaskRequest.method == "POST":
        return handleHttpPost(flaskRequest, endpoint)
    elif flaskRequest.method == "OPTIONS":
        return handleHttpOptions()
    else:
        raise exceptions.MethodNotAllowedException()
636953
def _make_post_request(self, uri, payload, timeout=None):
        
        if not timeout:
            timeout = self.timeout
        return self._make_request(requests.post, uri, data=payload, timeout=timeout)
20740
async def post(self, cmd, data=None, timeout=None, **args):
        """"""
        def _post_request():
            headers = copy(_DMAP_HEADERS)
            headers['Content-Type'] = 'application/x-www-form-urlencoded'
            return self.http.post_data(
                self._mkurl(cmd, *args),
                data=data,
                headers=headers,
                timeout=timeout)

        await self._assure_logged_in()
        return await self._do(_post_request)
1116876
async def send_request(self, params, timeout,
                           type='json_query', command=False):
        """"""
        try:
            with async_timeout.timeout(timeout):
                url = '{url}{type}'.format(
                    url=self._http_url,
                    type=type)
                async with self.websession.get(
                    url=url, params=params,
                        headers=self._headers) as response:
                    if response.status != HTTP_OK:
                        _LOGGER.warning(
                            "Error message %d from Epson.", response.status)
                        return False
                    if command == TURN_ON and self._powering_on:
                        self._powering_on = False
                    if type == 'json_query':
                        return await response.json()
                    return response
        except (aiohttp.ClientError, aiohttp.ClientConnectionError):
            _LOGGER.error("Error request")
            return False
216745
def request(self, path, method='GET', params=None):
        """"""
        if params is None: params = {}
        url = urljoin(self.endpoint, path)

        headers = {
            'Accept': 'application/json',
            'Authorization': 'AccessKey ' + self.access_key,
            'User-Agent': self.user_agent,
            'Content-Type': 'application/json'
        }

        if method == 'DELETE':
            response = requests.delete(url, verify=True, headers=headers, data=json.dumps(params))
        elif method == 'GET':
            response = requests.get(url, verify=True, headers=headers, params=params)
        elif method == 'PATCH':
            response = requests.patch(url, verify=True, headers=headers, data=json.dumps(params))
        elif method == 'POST':
            response = requests.post(url, verify=True, headers=headers, data=json.dumps(params))
        elif method == 'PUT':
            response = requests.put(url, verify=True, headers=headers, data=json.dumps(params))
        else:
            raise ValueError(str(method) + ' is not a supported HTTP method')

        if response.status_code in self.__supported_status_codes:
            response_text = response.text
        else:
            response.raise_for_status()

        return response_text
323199
def _make_request(self, path, method='GET', params_=None):
        """"""
        uri = self.api_root + path
        if params_:
            params_['text_format'] = self.response_format
        else:
            params_ = {'text_format': self.response_format}

        # Make the request
        response = None
        try:
            response = self._session.request(method, uri,
                                            timeout=self.timeout,
                                            params=params_)
        except Timeout as e:
            print("Timeout raised and caught:\n{e}".format(e=e))

        # Enforce rate limiting
        time.sleep(max(self._SLEEP_MIN, self.sleep_time))
        return response.json()['response'] if response else None
262255
def post(self, path, data=None, json_data=None, params=None):
        """"""
        r = requests.post(url=self.url + path, data=data, json=json_data, params=params, timeout=self.timeout)
        try:
            r.raise_for_status()
        except requests.exceptions.HTTPError:
            raise SwitcheoApiException(r.json()['error_code'], r.json()['error_message'], r.json()['error'])
        return r.json()
446869
def process_request(control, sym, args)
      instance = factory.call(control)

      instance.send(sym, *args)
    end
800248
def post(self, endpoint, data):
        
        headers = {
            "Content-Type": "application/json",
            "Accept": "application/json",
            "x-standardize-only": "true" if self.standardize else "false",
            "x-include-invalid": "true" if self.invalid else "false",
            "x-accept-keypair": "true" if self.accept_keypair else "false",
        }
        if not self.logging:
            headers["x-suppress-logging"] = "true"

        params = {"auth-id": self.auth_id, "auth-token": self.auth_token}
        url = self.BASE_URL + endpoint
        response = self.session.post(
            url,
            json.dumps(stringify(data)),
            params=params,
            headers=headers,
            timeout=self.timeout,
        )
        if response.status_code == 200:
            return response.json()

        raise ERROR_CODES.get(response.status_code, SmartyStreetsError)
1215484
def _request(self, path, method, body=None):
        """"""
        url = '/'.join([_SERVER, path])
        (resp, content) = _HTTP.request(url, method,
                                        headers=self._headers, body=body)

        content_type = resp.get('content-type')
        if content_type and content_type.startswith('application/json'):
            content = json.loads(content.decode('UTF-8'))

        return (resp, content)