|
1 | 1 | from dataclasses import dataclass |
2 | 2 | from datetime import datetime |
3 | 3 |
|
| 4 | +from ratelimit import sleep_and_retry, limits |
| 5 | + |
4 | 6 | from open_sea_v1.endpoints.abc import BaseEndpoint |
5 | | -from open_sea_v1.endpoints.client import BaseClient, ClientParams |
| 7 | +from open_sea_v1.endpoints.client import BaseClient, ClientParams, MAX_CALLS_PER_SECOND, RATE_LIMIT |
6 | 8 | from open_sea_v1.endpoints.urls import EndpointURLS |
7 | 9 | from open_sea_v1.responses.order import OrderResponse |
8 | 10 |
|
@@ -73,12 +75,6 @@ class OrdersEndpoint(BaseClient, BaseEndpoint): |
73 | 75 | 0 for fixed-price sales or min-bid auctions, and 1 for declining-price Dutch Auctions. |
74 | 76 | NOTE=use only_english=true for filtering for only English Auctions |
75 | 77 |
|
76 | | - limit: int |
77 | | - Number of orders to return (capped at 50). |
78 | | -
|
79 | | - offset: int |
80 | | - Number of orders to offset by (for pagination) |
81 | | -
|
82 | 78 | order_by: str |
83 | 79 | How to sort the orders. Can be created_date for when they were made, |
84 | 80 | or eth_price to see the lowest-priced orders first (converted to their ETH values). |
@@ -124,7 +120,10 @@ def parsed_http_response(self) -> list[CollectionResponse]: |
124 | 120 | orders = [OrderResponse(order_json) for order_json in orders_jsons] |
125 | 121 | return orders |
126 | 122 |
|
| 123 | + @sleep_and_retry |
| 124 | + @limits(calls=.25, period=RATE_LIMIT) |
127 | 125 | def _get_request(self, **kwargs): |
| 126 | + """Added slower rate limiing""" |
128 | 127 | params = dict( |
129 | 128 | asset_contract_address=self.asset_contract_address, |
130 | 129 | payment_token_address=self.payment_token_address, |
|
0 commit comments