Skip to content

Commit

Permalink
fix: http_ok check
Browse files Browse the repository at this point in the history
  • Loading branch information
Divya-Solulab committed Sep 27, 2024
1 parent c3e9ca2 commit f5b09ac
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 17 deletions.
8 changes: 4 additions & 4 deletions packages/packages.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
"contract/valory/merkl_distributor/0.1.0": "bafybeihaqsvmncuzmwv2r6iuzc5t7ur6ugdhephz7ydftypksjidpsylbq",
"contract/valory/staking_token/0.1.0": "bafybeifrvtkofw5c26b3irm6izqfdpik6vpjhm6hqwcdzx333h6vhdanai",
"contract/valory/staking_activity_checker/0.1.0": "bafybeibjzsi2r5b6xd4iwl4wbwldptnynryzsdpifym4mkv32ynswx22ou",
"skill/valory/liquidity_trader_abci/0.1.0": "bafybeibb37nibvq6ceseuptyqid6oevdr5taywmt5xrnyv4aom2yuboszy",
"skill/valory/optimus_abci/0.1.0": "bafybeiddcr6ynnhmpdxojtyf7inervcqjbar3wlujgauwvd27tuv2mctqe",
"agent/valory/optimus/0.1.0": "bafybeif57cip6khg67sczuw5rb77uzmuwmxdsmrzn2m44up2phktrill54",
"service/valory/optimus/0.1.0": "bafybeic2mihsbjf4cmgnztgcyvx3hluuicc6tgeja6dthflptgrur7b5iq"
"skill/valory/liquidity_trader_abci/0.1.0": "bafybeich6pbchgdy7v56dwfdq6btb2blcagfquhytdhaemdfgmtgk4hbv4",
"skill/valory/optimus_abci/0.1.0": "bafybeigdgah43tm2byc5ilynpxkcjkt2lh5euwjbb36shxjyn57alfb77i",
"agent/valory/optimus/0.1.0": "bafybeihoajamcrdv3yxsgrmfaeyhspjc6vt4jbwn3egmzcdszihtpjdno4",
"service/valory/optimus/0.1.0": "bafybeiasbh4wha2soe62izwwwtgf2vxcjyxe5nxqen4t66amfwbyho4v2u"
},
"third_party": {
"protocol/open_aea/signing/1.0.0": "bafybeihv62fim3wl2bayavfcg3u5e5cxu3b7brtu4cn5xoxd6lqwachasi",
Expand Down
4 changes: 2 additions & 2 deletions packages/valory/agents/optimus/aea-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ protocols:
skills:
- valory/abstract_abci:0.1.0:bafybeidz54kvxhbdmpruzguuzzq7bjg4pekjb5amqobkxoy4oqknnobopu
- valory/abstract_round_abci:0.1.0:bafybeiajjzuh6vf23crp55humonknirvv2f4s3dmdlfzch6tc5ow52pcgm
- valory/liquidity_trader_abci:0.1.0:bafybeibb37nibvq6ceseuptyqid6oevdr5taywmt5xrnyv4aom2yuboszy
- valory/optimus_abci:0.1.0:bafybeiddcr6ynnhmpdxojtyf7inervcqjbar3wlujgauwvd27tuv2mctqe
- valory/liquidity_trader_abci:0.1.0:bafybeich6pbchgdy7v56dwfdq6btb2blcagfquhytdhaemdfgmtgk4hbv4
- valory/optimus_abci:0.1.0:bafybeigdgah43tm2byc5ilynpxkcjkt2lh5euwjbb36shxjyn57alfb77i
- valory/registration_abci:0.1.0:bafybeiffipsowrqrkhjoexem7ern5ob4fabgif7wa6gtlszcoaop2e3oey
- valory/reset_pause_abci:0.1.0:bafybeif4lgvbzsmzljesxbphycdv52ka7qnihyjrjpfaseclxadcmm6yiq
- valory/termination_abci:0.1.0:bafybeiekkpo5qef5zaeagm3si6v45qxcojvtjqe4a5ceccvk4q7k3xi3bi
Expand Down
2 changes: 1 addition & 1 deletion packages/valory/services/optimus/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ aea_version: '>=1.0.0, <2.0.0'
license: Apache-2.0
fingerprint: {}
fingerprint_ignore_patterns: []
agent: valory/optimus:0.1.0:bafybeif57cip6khg67sczuw5rb77uzmuwmxdsmrzn2m44up2phktrill54
agent: valory/optimus:0.1.0:bafybeihoajamcrdv3yxsgrmfaeyhspjc6vt4jbwn3egmzcdszihtpjdno4
number_of_agents: 1
deployment: {}
---
Expand Down
15 changes: 7 additions & 8 deletions packages/valory/skills/liquidity_trader_abci/behaviours.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,6 @@
INTEGRATOR = "valory"
WAITING_PERIOD_FOR_BALANCE_TO_REFLECT = 5
WaitableConditionType = Generator[None, None, Any]
HTTP_OK = 200
HTTP_NOT_FOUND = 404
RETRIES = 5

Expand Down Expand Up @@ -955,7 +954,7 @@ def _fetch_all_pools(self) -> Generator[None, None, Optional[Dict[str, Any]]]:
headers={"accept": "application/json"},
)

if response.status_code != HTTP_OK:
if response.status_code not in HTTP_OK:
self.context.logger.error(
f"Could not retrieve data from url {api_url}. Status code {response.status_code}. Error Message: {response.body}"
)
Expand Down Expand Up @@ -1165,7 +1164,7 @@ def to_content(query: str) -> bytes:
url=url,
headers={"Content-Type": "application/json"},
)
if response.status_code != HTTP_OK:
if response.status_code not in HTTP_OK:
self.context.logger.error(
f"Received status code {response.status_code} from the API. Response: {response.body}"
)
Expand Down Expand Up @@ -1297,7 +1296,7 @@ def _get_top_tokens_by_value(self) -> Generator[None, None, Optional[List[Any]]]
if not chain or not asset_address:
continue
balance = asset.get("balance", 0)
if balance > 0:
if balance and balance > 0:
token_balances.append(
{
"chain": chain,
Expand Down Expand Up @@ -1708,7 +1707,7 @@ def _get_rewards(
headers={"accept": "application/json"},
)

if response.status_code != HTTP_OK:
if response.status_code not in HTTP_OK:
self.context.logger.error(
f"Could not retrieve data from url {api_url}. Status code {response.status_code}. Error Message: {response.body}"
)
Expand Down Expand Up @@ -2056,7 +2055,7 @@ def get_swap_status(
yield from self.sleep(self.params.waiting_period_for_status_check)
continue

if response.status_code != HTTP_OK:
if response.status_code not in HTTP_OK:
self.context.logger.error(
f"Received status code {response.status_code} from url {url}."
f"Message {response.body}"
Expand Down Expand Up @@ -2567,7 +2566,7 @@ def _get_step_transaction(
},
)

if response.status_code != HTTP_OK:
if response.status_code not in HTTP_OK:
response = json.loads(response.body)
self.context.logger.error(f"Error encountered: {response['message']}")
return None
Expand Down Expand Up @@ -2812,7 +2811,7 @@ def _simulate_execution_bundle(
},
)

if response.status_code != HTTP_OK:
if response.status_code not in HTTP_OK:
self.context.logger.error(
f"Could not retrieve data from url {api_url}. Status code {response.status_code}. Error Message {response.body}"
)
Expand Down
2 changes: 1 addition & 1 deletion packages/valory/skills/liquidity_trader_abci/skill.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ license: Apache-2.0
aea_version: '>=1.0.0, <2.0.0'
fingerprint:
__init__.py: bafybeia7bn2ahqqwkf63ptje6rfnftuwrsp33sswgpcbh5osbesxxr6g4m
behaviours.py: bafybeiaktfldwuypicsiqbyxjulesfxhfbbjzu6p7bwtpvfwx2cdyweqmq
behaviours.py: bafybeifrmkalngpld57inxxtyvdpqllfxjfornafbtovxamkmpadh6zpk4
dialogues.py: bafybeiay23otskx2go5xhtgdwfw2kd6rxd62sxxdu3njv7hageorl5zxzm
fsm_specification.yaml: bafybeiabbiulb7k6xkjysulmy6o4ugnhxlpp5jiaeextvwj65q4ttadoeq
handlers.py: bafybeidxw2lvgiifmo4siobpwuwbxscuifrdo3gnkjyn6bgexotj5f7zf4
Expand Down
2 changes: 1 addition & 1 deletion packages/valory/skills/optimus_abci/skill.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ skills:
- valory/registration_abci:0.1.0:bafybeiffipsowrqrkhjoexem7ern5ob4fabgif7wa6gtlszcoaop2e3oey
- valory/reset_pause_abci:0.1.0:bafybeif4lgvbzsmzljesxbphycdv52ka7qnihyjrjpfaseclxadcmm6yiq
- valory/termination_abci:0.1.0:bafybeiekkpo5qef5zaeagm3si6v45qxcojvtjqe4a5ceccvk4q7k3xi3bi
- valory/liquidity_trader_abci:0.1.0:bafybeibb37nibvq6ceseuptyqid6oevdr5taywmt5xrnyv4aom2yuboszy
- valory/liquidity_trader_abci:0.1.0:bafybeich6pbchgdy7v56dwfdq6btb2blcagfquhytdhaemdfgmtgk4hbv4
- valory/transaction_settlement_abci:0.1.0:bafybeielv6eivt2z6nforq43xewl2vmpfwpdu2s2vfogobziljnwsclmlm
behaviours:
main:
Expand Down

0 comments on commit f5b09ac

Please sign in to comment.