Skip to content
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

feat: Create a Exporter class to allow export data from LandingLens #174

Closed
wants to merge 5 commits into from

Conversation

CamiloInx
Copy link
Member

@CamiloInx CamiloInx commented Feb 8, 2024

Motivation

  • Create a Exporter class to provide the users with a set of methods to export data from LandingLens
  • The first method introduced is the export_event_logs() that allows organization owners the ability to export the event logs of the organization from the given time range.

Test

Added unit test

Screenshot 2024-02-07 at 8 31 42 PM


landingai/data_management/export.py Outdated Show resolved Hide resolved
landingai/data_management/export.py Outdated Show resolved Hide resolved
@CamiloInx CamiloInx self-assigned this Feb 8, 2024
from_date: str
In date following the format "YYYY-MM-DD"
save_path:
Desired path to save the csv file to: '/path/to/save/file.csv'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

optionally have to_date, if not provided, default to current time.

Comment on lines +67 to +70
def _download_file_from_signed_url(self, signed_url: str, save_path: str) -> None:
response = requests.get(signed_url)
with open(save_path, "wb") as file:
file.write(response.content)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's just webbrowser.open(signed_url) to directly download the resource through the browser.

api_key = "land_sk_12345"
client = Exporter(project_id, api_key)
res = client.export_event_logs("2021-06-01", "./local/path/to/save/file.csv")
assert res is None
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can return the signed_url and check the return value

Copy link

This PR is stale because it has been open 15 days with no activity. Remove stale label or comment or this will be closed in 7 days.

@github-actions github-actions bot added the Stale label Feb 28, 2024
Copy link

github-actions bot commented Mar 7, 2024

This PR was closed because it has been stalled for 7 days with no activity.

@github-actions github-actions bot closed this Mar 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants