def test_put_raise_status(): uri = "https://google.com/" with requests_mock.Mocker() as m: m.register_uri("POST", uri, status_code=403) with pytest.raises(requests.exceptions.HTTPError): res = HttpClient.post(uri) assert res.status_code == 403
def cancel_replace(cls, mid: str, contract_id: int, price: int, size: int) -> Dict: """Atomically swap an existing resting limit order with a new resting limit order. Price, side and size may be changed. Rate Limit Notice: This endpoint has a rate limit of 500 requests per 10 seconds. https://docs.ledgerx.com/reference#cancel-replace Args: mid (str): [description] contract_id (int): [description] price (int): [description] size (int): [description] Returns: Dict: [description] """ include_api_key = True url = gen_legacy_url(f"/orders/{mid}") qps = dict(contract_id=contract_id, price=price, size=size) res = HttpClient.post(url, qps, include_api_key) return res.json()