添加客服帐号。

        :param account: 客服账号的用户名
        :param nickname: 客服账号的昵称
        :param password: 客服账号的密码
        :return: 返回的 JSON 数据包
767990
def add_custom_service_account(self, account, nickname, password):
        
        return self.post(
            url="https://api.weixin.qq.com/customservice/kfaccount/add",
            data={
                "kf_account": account,
                "nickname": nickname,
                "password": password
            }
        )
824528
def get_account_config(self, id_or_name):
        
        if id_or_name in self._config:
            return self._config[id_or_name]
        if id_or_name in self._acct_name_to_id:
            return self._config[self._acct_name_to_id[id_or_name]]
        raise RuntimeError('ERROR: Unknown account ID or name')
354920
def newaccount(ctx, accountname, account, password):
    
    pprint(
        ctx.peerplays.create_account(accountname, registrar=account, password=password)
    )
1309811
def get_account(self, account_id, **params):
        """"""
        response = self._get('v2', 'accounts', account_id, params=params)
        return self._make_api_object(response, Account)
316925
def by_account(self, region, encrypted_account_id):
        
        url, query = SummonerApiV4Urls.by_account(
            region=region, encrypted_account_id=encrypted_account_id
        )
        return self._raw_request(self.by_account.__name__, region, url, query)
91695
def get_account(self, account_id, **kwargs):
        

        if 'mask' not in kwargs:
            kwargs['mask'] = 'status'

        return self.account.getObject(id=account_id, **kwargs)
5545
def list(
        self,
        **kwargs
    ):
        

        request = Request(
            'GET',
            '/v3/accounts'
        )

        response = self.ctx.request(request)


        if response.content_type is None:
            return response

        if not response.content_type.startswith("application/json"):
            return response

        jbody = json.loads(response.raw_body)

        parsed_body = {}

        #
        # Parse responses as defined by the API specification
        #
        if str(response.status) == "200":
            if jbody.get('accounts') is not None:
                parsed_body['accounts'] = [
                    self.ctx.account.AccountProperties.from_dict(d, self.ctx)
                    for d in jbody.get('accounts')
                ]

        elif str(response.status) == "401":
            if jbody.get('errorCode') is not None:
                parsed_body['errorCode'] = \
                    jbody.get('errorCode')

            if jbody.get('errorMessage') is not None:
                parsed_body['errorMessage'] = \
                    jbody.get('errorMessage')

        elif str(response.status) == "405":
            if jbody.get('errorCode') is not None:
                parsed_body['errorCode'] = \
                    jbody.get('errorCode')

            if jbody.get('errorMessage') is not None:
                parsed_body['errorMessage'] = \
                    jbody.get('errorMessage')

        #
        # Unexpected response status
        #
        else:
            parsed_body = jbody

        response.body = parsed_body

        return response
527750
def get_account_from_name(self, name):
        
        for account in self.accounts:
            if account.get_name() == name:
                return account
        return None
115703
public function addKFAccount($account,$nickname,$password){
        $data=array(
            "kf_account" =>$account,
            "nickname" => $nickname,
            "password" => md5($password)
        );
        if (!$this->access_token && !$this->checkAuth()) return false;
        $result = $this->http_post(self::API_BASE_URL_PREFIX.self::CS_KF_ACCOUNT_ADD_URL.'access_token='.$this->access_token,self::json_encode($data));
        if ($result)
        {
            $json = json_decode($result,true);
            if (!$json || !empty($json['errcode'])) {
                $this->errCode = $json['errcode'];
                $this->errMsg = $json['errmsg'];
                return false;
            }
            return $json;
        }
        return false;
    }
121879
def get(account):
        
        account = Account.get(account)
        if not account:
            return None

        acct_type = AccountType.get(account.account_type_id).account_type
        account_class = get_plugin_by_name(PLUGIN_NAMESPACES['accounts'], acct_type)

        return account_class(account)
1282321
def sync_accounts(self, accounts_data, clear = False, password=None, cb = None):
        

        # Map common values into the accounts records

        all_accounts = self.accounts

        kmap = Account.prop_map()

        for account_id, values in accounts_data.items():

            if not isinstance(values, dict):
                continue

            d = {}

            a = self.library.find_or_new_account(account_id)
            a.secret_password = password or self.password

            for k, v in values.items():
                if k in ('id',):
                    continue
                try:
                    if kmap[k] == 'secret' and v:
                        a.encrypt_secret(v)
                    else:
                        setattr(a, kmap[k], v)
                except KeyError:
                    d[k] = v

            a.data = d

            if values.get('service') == 's3':
                a.url = 's3://{}'.format(a.account_id)

            if cb:
                cb('Loaded account: {}'.format(a.account_id))

            self.database.session.commit()
1316034
def account(self, id):
        
        id = self.__unpack_id(id)
        url = '/api/v1/accounts/{0}'.format(str(id))
        return self.__api_request('GET', url)
907201
def delete_account(account_id, options = {})
      content_type = { 'Content-Type' => 'application/json' }
      content_type.merge(options[:headers]) if options[:headers]

      uri = build_uri("/accounts/#{account_id}")

      http = initialize_net_http_ssl(uri)
      request = Net::HTTP::Delete.new(uri.request_uri, headers(content_type))
      response = http.request(request)
      generate_log(request, response, uri)
      json = response.body
      json = '{}' if json.nil? || json == ''
      JSON.parse(json)
    end
1277069
public function addCustomServiceAccount($account, $nickName, $password)
    {
        $url    = sprintf(self::CS_ACCOUNT_ADD_URL, $this->getAccessTokenString());
        $client = $this->getHttpClient();
        $client->setUrl($url);
        $client->setHeaderArray(['Content-Type: application/json']);
        $client->setMethod(Client::METHOD_POST);
        $client->setPostFields($this->createCustomServiceParamString($account, $nickName, $password));
        if (!$client->exec()) {
            throw new Exception("call addCustomServiceAccount fail");
        }

        $result = json_decode($client->getResponse(), true);
        if (isset($result['errcode']) && isset($result['errmsg'])) {
            return (0 == $result['errcode']);
        }

        throw new Exception("error response for add custom service account");
    }
468293
def make_service_hooks_sync_nickname_action(service):
    
    def sync_nickname(modeladmin, request, queryset):
        for user in queryset:  # queryset filtering doesn't work here?
            service.sync_nickname(user)

    sync_nickname.__name__ = str('sync_{}_nickname'.format(slugify(service.name)))
    sync_nickname.short_description = "Sync nicknames for selected {} accounts".format(service.title)
    return sync_nickname
1136789
def create_account(self, email, password=None, attrs={}):
        
        attrs = [{'n': k, '_content': v} for k, v in attrs.items()]

        params = {'name': email, 'a': attrs}

        if password:
            params['password'] = password

        resp = self.request_single('CreateAccount', params)

        return zobjects.Account.from_dict(resp)
357275
def get_account(netid, timestamp=None):
    
    response = _get_account(netid, timestamp=timestamp)
    return _account_from_json(response)