-
Notifications
You must be signed in to change notification settings - Fork 10
Deprecates Retrive Event and introduces new Retrieve event where uid … #60
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
696fb80 to
9629357
Compare
|
Given this is just a new "alias", I would suggest that we don't mark it as deprecated. Instead, I would only document the new endpoint and add a small note saying:
|
|
Can we create a new entry for january changes here? |
|
Can we update the guides that used this endpoint to instead use the new one?
We will be able to update all the uid parsing logic. So, global search can now look like this: #!/usr/bin/env python3
import datetime
import os
import time
from flareio import FlareApiClient
api_key: str | None = os.environ.get("FLARE_API_KEY")
if not api_key:
raise Exception("Please provide an API key")
api_client = FlareApiClient(api_key=api_key)
from_timestamp: str = (
datetime.datetime.now(tz=datetime.timezone.utc) - datetime.timedelta(hours=1)
).isoformat()
last_from: str | None = None
fetched_pages: int = 0
for resp in api_client.scroll(
method="POST",
url="/firework/v4/events/global/_search",
json={
"size": 10,
"order": "asc",
"from": None,
"filters": {
"type": ["chat_message"],
"estimated_created_at": {"gte": from_timestamp},
},
"query": {
"type": "query_string",
"query_string": "hello",
},
},
):
# Rate limiting.
time.sleep(1)
resp_data: dict = resp.json()
items: list[dict] = resp_data["items"]
fetched_pages += 1
print(f"Fetched page {fetched_pages} with {len(items)} results...")
# Save the last "next" value.
last_from = resp_data.get("next") or last_from
# (Optional): Get the full data
for item in items:
# Rate limiting.
time.sleep(1)
event_response = api_client.get(
url="/firework/v2/activities/",
params={
"uid": item["metadata"]["uid"],
},
)
full_data = event_response.json()
print(f"Here is the full data of the event: {full_data}") |
|
Please wait for my approval before merging this. |
86782ec to
7eaae52
Compare
7eaae52 to
c96f0a7
Compare
c96f0a7 to
39b2b33
Compare
…is a query param
New Retrieve Event
Old Retrieve Event
Changelog