Skip to content
This repository was archived by the owner on Apr 24, 2024. It is now read-only.

Conversation

@Yelinz
Copy link
Member

@Yelinz Yelinz commented Sep 9, 2022

maybe multipart isnt the right choice?

Copy link

@winged winged left a comment

Choose a reason for hiding this comment

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

Looking good so far! I like that you're going the async way, I think it's a good project to get some python async experience

async def get_caluma_data(request):
data = await request.content.read()
data_object = json.loads(data)
data_object["query"] = data_object["query"].replace("\n", "")
Copy link

Choose a reason for hiding this comment

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

Should not be needed, or why is this here?

async with ClientSession() as session:
async with session.post(
env.str("CALUMA_ENDPOINT", default="http://caluma:8000/graphql"),
"http://localhost:8000/graphql",
Copy link

Choose a reason for hiding this comment

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

Shouldn't be hardcoded I guess

Comment on lines +56 to +57
part = mpwriter.append(",".join(headers), {"Content-Type": "text/csv"})
part.set_content_disposition("attachment", filename="export.csv")
Copy link

Choose a reason for hiding this comment

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

I suggest using the CSV module for generating CSV - this way, you're getting proper quoting etc for free

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants