Rewrite all rest examples according to v3.0.0b3's changes.

This commit is contained in:
Davide Casale
2023-10-26 17:46:38 +02:00
parent 9287723678
commit 1ec6c49428
15 changed files with 141 additions and 139 deletions

View File

@@ -1,20 +1,20 @@
# python -c "import examples.rest.public.pulse_endpoints"
import datetime
from typing import List
from bfxapi import Client, PUB_REST_HOST
from bfxapi import Client
from bfxapi.types import PulseMessage, PulseProfile
bfx = Client(rest_host=PUB_REST_HOST)
bfx = Client()
# POSIX timestamp in milliseconds (check https://currentmillis.com/)
end = datetime.datetime(2020, 5, 2).timestamp() * 1000
# Retrieves 25 pulse messages up to 2020/05/02
messages: List[PulseMessage] = bfx.rest.public.get_pulse_message_history(end=end, limit=25)
messages: List[PulseMessage] = bfx.rest.public.get_pulse_message_history(
end=end, limit=25
)
for message in messages:
print(f"Message author: {message.profile.nickname} ({message.profile.puid})")
@@ -23,4 +23,7 @@ for message in messages:
profile: PulseProfile = bfx.rest.public.get_pulse_profile_details("News")
URL = profile.picture.replace("size", "small")
print(f"<{profile.nickname}>'s profile picture: https://s3-eu-west-1.amazonaws.com/bfx-pub/{URL}")
print(
f"<{profile.nickname}>'s profile picture:"
f" https://s3-eu-west-1.amazonaws.com/bfx-pub/{URL}"
)