Convert from user request for place order to PLS request
970226
def pack_req(cls, modify_order_op, order_id, price, qty,
                 adjust_limit, trd_env, acc_id, trd_mkt, conn_id):
        """"""
        from futuquant.common.pb.Trd_ModifyOrder_pb2 import Request
        req = Request()
        serial_no = get_unique_id32()
        req.c2s.packetID.serialNo = serial_no
        req.c2s.packetID.connID = conn_id

        req.c2s.header.trdEnv = TRD_ENV_MAP[trd_env]
        req.c2s.header.accID = acc_id
        req.c2s.header.trdMarket = TRD_MKT_MAP[trd_mkt]

        req.c2s.orderID = int(order_id)
        req.c2s.modifyOrderOp = MODIFY_ORDER_OP_MAP[modify_order_op]
        req.c2s.forAll = False

        if modify_order_op == ModifyOrderOp.NORMAL:
            req.c2s.qty = qty
            req.c2s.price = price
            req.c2s.adjustPrice = adjust_limit != 0
            req.c2s.adjustSideAndLimit = adjust_limit

        return pack_pb_req(req, ProtoId.Trd_ModifyOrder, conn_id, serial_no)
445223
def place_order(self, amount, price, side, ord_type, symbol='btcusd', exchange='bitfinex'):
        
        payload = {

            "request": "/v1/order/new",
            "nonce": self._nonce,
            "symbol": symbol,
            "amount": amount,
            "price": price,
            "exchange": exchange,
            "side": side,
            "type": ord_type

        }

        signed_payload = self._sign_payload(payload)
        r = requests.post(self.URL + "/order/new", headers=signed_payload, verify=True)
        json_resp = r.json()

        try:
            json_resp['order_id']
        except:
            return json_resp['message']

        return json_resp
260985
private function _convertGetOrder($request) {

        $parameters = array();
        $parameters['Action'] = 'GetOrder';
        if ($request->isSetSellerId()) {
            $parameters['SellerId'] =  $request->getSellerId();
        }
        if ($request->isSetMWSAuthToken()) {
            $parameters['MWSAuthToken'] =  $request->getMWSAuthToken();
        }
        if ($request->isSetAmazonOrderId()) {
            $parameters['AmazonOrderId'] =  $request->getAmazonOrderId();
        }

        return $parameters;
    }
947085
private List<OrderSpecifier> getOrderByList(HttpServletRequest request) throws Exception {
		String[] orderByStrings = request.getParameterValues("orderBy");
		if( null == orderByStrings ) {
			return null;
		}
		if( 0 == orderByStrings.length ) {
			return null;
		}
		
		List<OrderSpecifier> result = new Vector<OrderSpecifier>();
		
		for(String orderByString : orderByStrings) {
			OrderSpecifier orderSpecifier = parseOrderSpecifier(orderByString);
			result.add(orderSpecifier);
		}

		return result;
	}
48345
def batch(request, request_options = {})
      client.post(Protocol.batch_uri(name), request.to_json, :batch, request_options)
    end
200723
def canonical_request(self, method, path, content, timestamp):
        """"""
        request = collections.OrderedDict([
            ('Method', method.upper()),
            ('Hashed Path', path),
            ('X-Ops-Content-Hash', content),
            ('X-Ops-Timestamp', timestamp),
            ('X-Ops-UserId', self.user_id),
        ])
        return '\n'.join(['%s:%s' % (key, value)
                          for key, value in request.items()])
107199
def getOrders(self, auction_ids):
        """"""
        orders = {}
        # chunk list (only 25 auction_ids per request)
        for chunk in chunked(auction_ids, 25):
            # auctions = [{'item': auction_id} for auction_id in chunk]  # TODO?: is it needed?
            auctions = self.ArrayOfLong(chunk)
            rc = self.__ask__('doGetPostBuyData', itemsArray=auctions)
            for auction in rc:
                orders_auction = []
                bids = self.getBids(auction['itemId'])
                # get orders details
                # for i in auction.get('usersPostBuyData', ()):
                if not auction['usersPostBuyData']:  # empty
                    continue
                for i in auction['usersPostBuyData']['item']:
                    i = i['userData']
                    if i['userId'] not in bids:  # temporary(?) webapi bug fix
                        continue
                    orders_auction.append({
                        'allegro_aid': auction['itemId'],
                        'allegro_uid': i['userId'],
                        'allegro_login': magicDecode(i['userLogin']),
                        'name': magicDecode(i['userFirstName']),
                        'surname': magicDecode(i['userLastName']),
                        'company': magicDecode(i['userCompany']),
                        'postcode': magicDecode(i['userPostcode']),
                        'city': magicDecode(i['userCity']),
                        'address': magicDecode(i['userAddress']),
                        'email': magicDecode(i['userEmail']),
                        'phone': i['userPhone'],
                        'price': bids[i['userId']]['price'],
                        'quantity': bids[i['userId']]['quantity'],
                        'date_buy': bids[i['userId']]['date_buy']
                    })
                orders[auction['itemId']] = orders_auction
        return orders
1295957
function create ($request, $match)
    {
        $extra = array(
                'user' => $request->user,
                'tenant' => $request->tenant
        );
        $form = new Geo_Form_Location(
                array_merge($request->REQUEST, $request->FILES), $extra);
        $cuser = $form->save();
        $request->user->setMessage(
                sprintf(__('the location %s has been created.'), 
                        (string) $cuser->name));
        
        User_Shortcuts_UpdateLeveFor($request->user, "jahanjoo_location_add");
        // Return response
        return new Pluf_HTTP_Response_Json($cuser);
    }
880368
function(req, res, next) {
        var initialTime = 0,
            receivedReqTime = new Date().getTime();

        req.requestDelay =  receivedReqTime - initialTime;
        var url = req.body.url;

        request.get(url, function (error, response, body) {
            if (!error && response.statusCode == 200) {
                req.rawOntology = body.toString().replace(/(&)([a-z0-9]+)(;)/gi, '$2:');
                next();
            }
        });
    }
960016
def search_order(self, limit=100, offset=0, common_name_pattern=None, status=None,
                     contact_handle=None):
        """"""

        response = self.request(E.searchOrderSslCertRequest(
            E.limit(limit),
            E.offset(offset),
            OE('commonNamePattern', common_name_pattern),
            OE('status', status, transform=_simple_array),
            OE('contactHandle', contact_handle),
        ))

        return response.as_models(SSLOrder)
1198280
function requestHandler(req, res, next) {
  const start = Date.now();
  let source;

  return Promise.try(() => {
    source = core.getPublicSource(req.params.src);
    return source.getHandler().getInfoAsync().then(info => [info, infoHeaders]);
  }).spread((data, dataHeaders) => {
    core.setResponseHeaders(res, source, dataHeaders);

    if (req.query && req.query.format) {
      const escapedText = JSON.stringify(data, null, ' ').replace(/&/g, '&amp;').replace(/</g, '&lt;');
      res.send(`<pre>${escapedText}</pre>`);
    } else {
      res.json(data);
    }

    const mx = util.format('req.%s.info', req.params.src);
    core.metrics.endTiming(mx, start);
  }).catch(err => core.reportRequestError(err, res)).catch(next);
}
895325
def batchcancel_orders(self, order_ids: list, _async=False):
        
        assert isinstance(order_ids, list)
        params = {'order-ids': order_ids}
        path = f'/v1/order/orders/batchcancel'
        return api_key_post(params, path, _async=_async)
415052
function formatRequest(p, qs) {
		var token = qs.access_token;
		delete qs.access_token;
		p.headers.Authorization = 'Bearer ' + token;

		return true;
	}
63514
def _get_req_fp(self, op):
		''''''
		if(op):
			op = op.lower()
			if op == 'get':
				return requests.get, None
			if op == 'put':
				return requests.put, {'Content-Type': 'application/x-www-form-urlencoded'}
			if op == 'post':
				return requests.post, {'Content-Type': 'application/json'}
			if op == 'delete':
				return requests.delete, None
		else:
			raise NotImplementedError('Operation {} is not supported!'.format(op))
1210425
function parseListRequest(req){
  var reqObj = {};
  reqObj.originalUrl = req.originalUrl;
  reqObj.uid = req.params.guid;
  reqObj.env = req.params.environment;
  reqObj.domain = req.params.domain;
  return reqObj;
}
418756
def _prepare_request_json(self, kwargs):
        """"""

        # Check for python keywords in dict
        kwargs = self._check_for_python_keywords(kwargs)

        # Check for the key 'check' in kwargs
        if 'check' in kwargs:
            od = OrderedDict()
            od['check'] = kwargs['check']
            kwargs.pop('check')
            od.update(kwargs)
            return od
        return kwargs
1074898
def url_for_request(query, sort_by: nil, order: nil)
      url = "https://api.github.com/search/issues?q="
      url += ERB::Util.url_encode(query)
      url += "+repo:#{repo_owner}/#{repo_name}"
      url += "&sort=#{sort_by}" if sort_by
      url += "&order=#{order}" if order

      url
    end