POST a dictionary to an API method,
        for example /a/.../accounts/id/upgrade
185031
def _call_resource_method(self, cls, id, method_name, data):
        """"""

        if cls.api_root != "a":
            url_path = "/{name}/{id}/{method}".format(
                name=cls.collection_name, id=id, method=method_name
            )
        else:
            # Management method.
            url_path = "/a/{app_id}/{name}/{id}/{method}".format(
                app_id=self.app_id, name=cls.collection_name, id=id, method=method_name
            )

        url = URLObject(self.api_server).with_path(url_path)
        converted_data = convert_datetimes_to_timestamps(data, cls.datetime_attrs)

        session = self._get_http_session(cls.api_root)
        response = session.post(url, json=converted_data)

        result = _validate(response).json()
        return cls.create(self, **result)
566396
def request_change_variable_json(self, py_db, request, thread_id):
        '''
        
        '''
        py_db.post_method_as_internal_command(
            thread_id, internal_change_variable_json, request)
951878
def save
      method, path = id ? [:post, :update] : [:put, :create]
      self.attributes = Connection.send(method, create_route(path), attributes_without_blanks).body['data']
      self
    end
1211835
def post(self, uri, params={}, data={}):
        ''''''
        return requests.post(
            urlparse.urljoin(self.BASE_URL, uri),
            params=params, data=json.dumps(data), verify=False,
            auth=self.auth, headers = {'Content-type': 'application/json', 'Accept': 'text/plain'})
203121
def update(self, typ, id, **kwargs):
        
        return self._load(self._request(typ, id=id, method='PUT', data=kwargs))
183314
def call(method, data, post=False):
    
    url = "%s%s" % ('http://disqus.com/api/', method)
    if post:
        # POST request
        url += "/"
        data = urlencode(data)
    else:
        # GET request
        url += "?%s" % urlencode(data)
        data = ''
    res = json.load(urlopen(url, data))
    if not res['succeeded']:
        raise CommandError("'%s' failed: %s\nData: %s" % (method, res['code'], data))
    return res['message']
322803
def post(self, uri, params={}, data={}):
        '''
        '''
        return self._session.post(
            urljoin(Investigate.BASE_URL, uri),
            params=params, data=data, headers=self._auth_header,
            proxies=self.proxies
        )
804993
def http_method(self, data):
        """"""
        data = data.upper()
        if data in ['DELETE', 'GET', 'POST', 'PUT']:
            self._http_method = data

            # set content type for commit methods (best guess)
            if self._headers.get('Content-Type') is None and data in ['POST', 'PUT']:
                self.add_header('Content-Type', 'application/json')
        else:
            raise AttributeError(
                'Request Object Error: {} is not a valid HTTP method.'.format(data)
            )
833661
def run_dict_method(self, request):
        """"""
        state_method_name, args, kwargs = (
            request[Msgs.info],
            request[Msgs.args],
            request[Msgs.kwargs],
        )
        # print(method_name, args, kwargs)
        with self.mutate_safely():
            self.reply(getattr(self.state, state_method_name)(*args, **kwargs))
1109543
def update(self, uid: str, patch=False, data: any = {}) -> typing.Union[str, dict]:
        
        methodType = 'put' if patch is False else 'patch'
        return self.__client.request(methodType, '/forms/%s' % uid, data=data)
303097
def post(json_data,
         url,
         dry_run=False):
    

    if dry_run:
        info('POST: %s' % json.dumps(json_data, indent=4))
    else:
        response = SESSION.post(url,
                                data=json.dumps(json_data),
                                headers={'content-type': 'application/json'})

        if response.status_code != 200:
            raise Exception("Failed to import %s with %s: %s" %
                            (json_data, response.status_code, response.text))
1014444
def run(self, target, payload, instance=None, hook_id=None, **kwargs):
        
        self.post_data(target, payload, hook_id)
776249
def post(method, hmc, uri, uri_parms, body, logon_required,
             wait_for_completion):
        """"""
        assert wait_for_completion is True  # synchronous operation
        user_oid = uri_parms[0]
        user_uri = '/api/users/' + user_oid
        try:
            user = hmc.lookup_by_uri(user_uri)
        except KeyError:
            raise InvalidResourceError(method, uri)
        check_required_fields(method, uri, body, ['user-role-uri'])
        user_type = user.properties['type']
        if user_type in ('pattern-based', 'system-defined'):
            raise BadRequestError(
                method, uri, reason=314,
                message="Cannot add user role to user of type {}: {}".
                format(user_type, user_uri))
        user_role_uri = body['user-role-uri']
        try:
            hmc.lookup_by_uri(user_role_uri)
        except KeyError:
            raise InvalidResourceError(method, user_role_uri, reason=2)
        if user.properties.get('user-roles', None) is None:
            user.properties['user-roles'] = []
        user.properties['user-roles'].append(user_role_uri)
674342
def post(method, hmc, uri, uri_parms, body, logon_required,
             wait_for_completion):
        """"""
        assert wait_for_completion is True  # async not supported yet
        try:
            resource = hmc.lookup_by_uri(uri)
        except KeyError:
            raise InvalidResourceError(method, uri)
        resource.update(body)
657093
def updateMember(self, data, address, id, headers=None, query_params=None, content_type="application/json"):
        
        uri = self.client.base_url + "/network/"+id+"/member/"+address
        return self.client.post(uri, data, headers, query_params, content_type)
312104
def _update(self, resource, update_dict=None, params=None, **kwargs):
        """"""
        url = self._client._build_url(resource, **kwargs)
        response = self._client._request('PUT', url, json=update_dict, params=params)

        if response.status_code != requests.codes.ok:  # pragma: no cover
            raise APIError("Could not update {} ({})".format(self.__class__.__name__, response.json().get('results')))
        else:
            self.refresh()
492202
def account_update(self, data, **kwargs):
        ""
        api_path = "/api/v2/account"
        return self.call(api_path, method="PUT", data=data, **kwargs)