Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Add contest export script #3039

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

Merged
eldering merged 4 commits into main from add-contest-export
Sep 2, 2025
Merged

Add contest export script #3039

eldering merged 4 commits into main from add-contest-export
Sep 2, 2025

Conversation

Copy link
Member

@eldering eldering commented Jul 15, 2025

Closes #2726

Copy link
Member

@nickygerritsen nickygerritsen left a comment

Choose a reason for hiding this comment

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

Some small comments but I like it

recurse_find_files(data[0], store_path, default_name)
else:
for i, item in enumerate(data):
recurse_find_files(item, store_path, f"{default_name}.{i}")
Copy link
Member

@nickygerritsen nickygerritsen Jul 15, 2025

Choose a reason for hiding this comment

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

Initially we pass '' in default_name, so this becomes .{i}? (same with .{key} below)

Copy link
Member Author

Choose a reason for hiding this comment

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

Hmm, I think you're right. The idea is that this builds up a default file name while recursively descending into the object's structure. So at the base level you always find the object itself as a dict, and that means that at line 94 default_name is set to the property key, but as you say with a prefix .. So for example for multiple JPEG files in the array under contest.logo, their default names would become .logo.0.jpg, .logo.1.jpg. So that first . must indeed be stripped.

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed by using default argument default_name = None and adding . based on that.


if ext == '.json':
data = json.loads(data)
store_path = name
Copy link
Member

@nickygerritsen nickygerritsen Jul 15, 2025

Choose a reason for hiding this comment

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

Why use store_path here? Can't we just use name below?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, I think so. I guess this is a left-over of previous refactoring. It's a bit annoying that there's too many similar concepts floating around: name of the endpoint, endpoint path in the URL, path to store the downloaded endpoint data to on disk, and filename on disk.

Copy link
Member Author

Choose a reason for hiding this comment

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

Replaced store_path by name and documented the parameters better.

@eldering eldering force-pushed the add-contest-export branch 2 times, most recently from 71e854b to e93273e Compare August 17, 2025 11:39
@eldering eldering force-pushed the add-contest-export branch 2 times, most recently from 2485a42 to 1b40824 Compare September 1, 2025 11:36
...via CLI
Fetching the event feed from the API via `internalApiRequest` wasn't
working since it returns a StreamedResponse. Fix this by only using
an output buffer in `internalApiRequest` and only calling `ob_flush`
from `getEventFeedAction` if the top-level output buffer allows it.
Also return contents from `internalApiRequest` without JSON decoding
it, since the event feed endpoint is NDJSON, *not* JSON. Explicitly
decode the JSON at the other places calling internalApiRequest`.
This will be used by the contest export script for downloading
the event feed (NDJSON) and other files.
Also improve error reporting when an internal API call fails.
Otherwise the original error is hidden making this test failing
very hard to debug. This should also be improved in the other
tests that follow redirects.
@eldering eldering added this pull request to the merge queue Sep 2, 2025
Merged via the queue into main with commit 5c5b651 Sep 2, 2025
42 checks passed
@eldering eldering deleted the add-contest-export branch September 2, 2025 15:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Reviewers

@nickygerritsen nickygerritsen nickygerritsen left review comments

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

Add export-contest script

AltStyle によって変換されたページ (->オリジナル) /