Skip to content

Commit

Permalink
fix: manual encode array params for hermes
Browse files Browse the repository at this point in the history
  • Loading branch information
Reisen committed Feb 8, 2024
1 parent 1218ac1 commit 480459f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ ignore_missing_imports = true

[tool.poetry]
name = "pyth-observer"
version = "0.1.10"
version = "0.1.12"
description = "Alerts and stuff"
authors = []
readme = "README.md"
Expand Down
5 changes: 4 additions & 1 deletion pyth_observer/crosschain.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,11 @@ async def get_crosschain_prices(self) -> Dict[str, CrosschainPrice]:
for ids in chunked(price_feed_ids, 25):
price_feeds_url = f"{self.url}/api/latest_price_feeds"

# aiohttp does not support encoding array params using PHP-style `ids=[]`
# naming, so we encode it manually and append to the URL.
query_string = "?" + "&".join(f"ids[]={v}" for v in ids)
async with session.get(
price_feeds_url, params={"ids": ids}
price_feeds_url + query_string,
) as response:
price_feeds += await response.json()

Expand Down
5 changes: 3 additions & 2 deletions sample.config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@ network:
http_endpoint: "https://pythnet.rpcpool.com"
ws_endpoint: "wss://pythnet.rpcpool.com"
first_mapping: "AHtgzX45WTKfkPG53L6WYhGEXwQkN1BVknET3sVsLL8J"
crosschain_endpoint: "https://xc-mainnet.pyth.network"
crosschain_endpoint: "https://hermes.pyth.network"
request_rate_limit: 10
request_rate_period: 1
events:
- DatadogEvent
# NOTE: Uncomment to enable Datadog metrics, see README.md for datadog credential docs.
# - DatadogEvent
- LogEvent
checks:
global:
Expand Down

0 comments on commit 480459f

Please sign in to comment.