Implement libgreader's interface for authenticated POST request
3852
def post(self, url, postParameters=None, urlParameters=None):
        
        if self._action_token == None:
            self._action_token = self.get(ReaderUrl.ACTION_TOKEN_URL)

        if self._http == None:
            self._setupHttp()
        uri = url + "?" + self.getParameters(urlParameters)
        postParameters.update({'T':self._action_token})
        body = self.postParameters(postParameters)
        response, content = self._http.request(uri, "POST", body=body)
        return content
1303138
public String post(String url, String payload) throws AuthenticationException, ApiException {
		return performRequest(url, "POST", null, null, payload);
	}
329633
def request(self, method, url, **kwargs):
        ""
        user_token = kwargs.pop('token', self.token)
        token, secret = self.parse_raw_token(user_token)
        callback = kwargs.pop('oauth_callback', None)
        verifier = kwargs.get('data', {}).pop('oauth_verifier', None)
        oauth = OAuth1(
            resource_owner_key=token,
            resource_owner_secret=secret,
            client_key=self.provider.consumer_key,
            client_secret=self.provider.consumer_secret,
            verifier=verifier,
            callback_uri=callback,
        )
        kwargs['auth'] = oauth
        return super(OAuthClient, self).request(method, url, **kwargs)
985258
def authenticate(api_key, api_url, **kwargs):
    """"""

    muddle = Muddle(**kwargs)

    # Login.
    muddle.authenticate(api_key, api_url)
    return muddle
463049
def authenticated(function):
    """"""
    def wrapped(*args):
        """Wrap function."""
        try:
            return function(*args)
        except USPSError:
            _LOGGER.info("attempted to access page before login")
            _login(args[0])
            return function(*args)
    return wrapped
903712
function authenticate(tenantOrSupertenantId, logmetToken, isSuperTenant) {
    // Identification frame:
    // 1 | I | id_size | id
    var idFrameTypeAndVersion = '1I';
    var clientIdString = 'standalone_dlms_data_client_v0.0.1_' + os.hostname();
    logger.info('Identifying the Logmet client: ' + clientIdString);

    var idDataBuffer = new Buffer(idFrameTypeAndVersion.length + 1 + clientIdString.length);

    idDataBuffer.write(idFrameTypeAndVersion, 0 , idFrameTypeAndVersion.length);

    idDataBuffer.writeUIntBE(clientIdString.length, idFrameTypeAndVersion.length, 1);
    idDataBuffer.write(clientIdString, idFrameTypeAndVersion.length + 1, clientIdString.length);

    // Send the identification frame to Logmet
    tlsSocket.write(idDataBuffer);

    // Authentication frame:
    // 2 | S or T | tenant_id_size | tenant_id | token_size | token
    var authFrameTypeAndVersion = isSuperTenant ? '2S' : '2T';
    logger.info('Authenticating with Logmet with frame type: ' + authFrameTypeAndVersion[1]);

    var bufferSize = authFrameTypeAndVersion.length + tenantOrSupertenantId.length + logmetToken.length + 2;
    var authDataBuffer = new Buffer(bufferSize);

    authDataBuffer.write(authFrameTypeAndVersion, 0, authFrameTypeAndVersion.length);

    authDataBuffer.writeUIntBE(tenantOrSupertenantId.length, authFrameTypeAndVersion.length, 1);
    authDataBuffer.write(tenantOrSupertenantId, authFrameTypeAndVersion.length + 1, tenantOrSupertenantId.length);

    authDataBuffer.writeUIntBE(logmetToken.length, authFrameTypeAndVersion.length + 1 + tenantOrSupertenantId.length, 1);
    authDataBuffer.write(logmetToken, authFrameTypeAndVersion.length + 1 + tenantOrSupertenantId.length + 1, logmetToken.length);

    // Send the authentication frame to Logmet
    tlsSocket.write(authDataBuffer);
}
235568
def post(self, url, postParameters=None, urlParameters=None):
        
        if urlParameters:
            url = url + "?" + self.getParameters(urlParameters)
        headers = {'Authorization':'GoogleLogin auth=%s' % self.auth_token,
                    'Content-Type': 'application/x-www-form-urlencoded'
                    }
        postString = self.postParameters(postParameters)
        req = requests.post(url, data=postString, headers=headers)
        return req.text
742991
protected void invokeAuthenticationPostProcessors(final AuthenticationBuilder builder,
                                                      final AuthenticationTransaction transaction) {
        LOGGER.debug("Invoking authentication post processors for authentication transaction");
        val pops = authenticationEventExecutionPlan.getAuthenticationPostProcessors(transaction);

        final Collection<AuthenticationPostProcessor> supported = pops.stream().filter(processor -> transaction.getCredentials()
            .stream()
            .anyMatch(processor::supports))
            .collect(Collectors.toList());
        for (val p : supported) {
            p.process(builder, transaction);
        }
    }
1152278
private <TResponse> TResponse callServiceOwnerGetApi(
            String path, Map<String, String> queryParams,
            Class<TResponse> responseClass) throws AuthleteApiException
    {
        return callGetApi(mServiceOwnerCredentials, path, queryParams, responseClass);
    }
476815
def authenticationRequest():
    """"""
    a = TpPd(pd=0x5)
    b = MessageType(mesType=0x12)  # 00010010
    c = CiphKeySeqNrAndSpareHalfOctets()
    d = AuthenticationParameterRAND()
    packet = a / b / c / d
    return packet
1050070
private <TResponse> TResponse callServiceGetApi(
            String path, Map<String, String> queryParams,
            Class<TResponse> responseClass) throws AuthleteApiException
    {
        return callGetApi(mServiceCredentials, path, queryParams, responseClass);
    }
590202
def perform(arguments = {})
      case type.to_sym
      when :post, :get
        api.public_send(type, path, @arguments.merge(arguments))
      else
        raise ArgumentError, "Unregistered request type #{request_type}"
      end
    end
1352522
function postAuthUser(req, res) {
    if (!req.body.username || !req.body.password || !req.body.displayName ||
      !
      req
      .body.email) {
      res.status(422).send('You must provide username, email, and password');
      return;
    }

    var user = new users(req.body);
    // user.displayName = req.body.displayName;
    // user.username = req.body.username;
    // user.email = req.body.email;
    // if(req.body.userdata_id) {
    //   // This is a hack, needs to be removed. #todo
    //   user.userdata_id = req.body.userdata_id;
    // }

    passwordAuth.saveUser(user, req.body.password)
      .then(function (user) {
        if (user) {
          log.info('New user saved to the database:', user.username);
          res.status(200).send(user);
        }
      }, function (err) {
        if (err && err.code === 11000) {
          // code 11000 is a mongoose code for duplicate key error
          log.error('Could not save user. Is username and email unique? ' +
            err
            .message);
          return res.status(422).send('Username already exists.');
        } else {
          throw err;
        }
      })
      .then(null, function (err) {
        log.error(err.message);
        return res.status(500).send('Internal error');
      });
  }
858217
def post(self, request):
        """"""
        serializer = AuthTokenSerializer(data=request.data)

        if serializer.is_valid():
            token, _ = ExpiringToken.objects.get_or_create(
                user=serializer.validated_data['user']
            )

            if token.expired():
                # If the token is expired, generate a new one.
                token.delete()
                token = ExpiringToken.objects.create(
                    user=serializer.validated_data['user']
                )

            data = {'token': token.key}
            return Response(data)

        return Response(serializer.errors, status=HTTP_400_BAD_REQUEST)
325812
def authenticated(function):
    """"""
    def wrapped(*args):
        """Wrap function."""
        try:
            return function(*args)
        except FedexError:
            _login(*args)
            return function(*args)
    return wrapped
146676
def post_loader(*decorator_args, serializer):
    
    def wrapped(fn):
        @wraps(fn)
        def decorated(*args, **kwargs):
            return fn(*serializer.load(request.get_json()))
        return decorated

    if decorator_args and callable(decorator_args[0]):
        return wrapped(decorator_args[0])
    return wrapped
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)