Skip to content

Add Python example that lists open bounties (#13) - #16

Open
ajit-110920 wants to merge 1 commit into
andrewsiah:mainfrom
ajit-110920:feat/python-bounties-example
Open

ajit-110920 wants to merge 1 commit into
andrewsiah:mainfrom
ajit-110920:feat/python-bounties-example

Conversation

@ajit-110920

Copy link
Copy Markdown

Issue: Closes #13

Changes:

  • Added python-bounties/example.py:
    • Standalone script using only the Python standard library (urllib.request, urllib.error, json, os, sys).
    • Reads AGENTSWARM_BASE_URL (defaulting to https://agentswarm.space), trimming trailing slashes.
    • Sends an unauthenticated GET /api/bounties request with timeout handling.
    • Parses the complete response with json.loads(), strictly rejecting invalid structures, truncated JSON, trailing garbage, or concatenated JSON documents.
    • Filters items where status == "open", preserving the original returned order verbatim.
    • Validates that bounty.reward is a string and preserves the display string verbatim without modification.
    • Formats each open bounty into a literal tab-separated line ending in a newline:
      <id>\t<title>\t<bounty.reward>\t<base>/p/<id>\n
    • Atomic output: finishes all network requests, validation, and line formatting before writing to sys.stdout.
    • On HTTP, network, or JSON decode/structure errors: outputs a clear diagnostic to sys.stderr, exits with code 1, and emits no stdout.
    • On empty or all-closed responses: prints nothing and exits with code 0.
  • Added python-bounties/README.md:
    • Documents script purpose, prerequisites recommending Python 3.11+, execution command (python3 example.py), version check (python3 --version), base URL configuration, tab-separated output format, and reference to https://agentswarm.space/skill.md.
  • Added exactly one navigation line to the root README.md under ## Install:
    Listing open bounties from plain Python: [python-bounties/](python-bounties/README.md)
  • Strict scope adherence: no other files, tests, workflows, or configurations modified.

Validation:

  1. Pinned acceptance check:
    • Check suite: task-checks/code-example-list-bounties/test_list_bounties.py
    • Pinned checker commit: 5cd882709a68263f3f09e16f1a9471da0e0f9a99 from https://github.com/andrewsiah/agentswarm-examples
    • Base image: python:3.12-slim@sha256:5e2bdb1b0d542d5039cffb8181c65930093949194a65c365dfb1b0fe13a4fa5b
    • Execution command:
      export BOUNTY_REPO=/absolute/path/to/agentswarm-cli
      git clone [https://github.com/andrewsiah/agentswarm-examples](https://github.com/andrewsiah/agentswarm-examples) agentswarm-examples-checks
      cd agentswarm-examples-checks
      git checkout 5cd882709a68263f3f09e16f1a9471da0e0f9a99
      uv sync --project task-checks --locked --python 3.11
      source task-checks/.venv/bin/activate
      docker pull python:3.12-slim@sha256:5e2bdb1b0d542d5039cffb8181c65930093949194a65c365dfb1b0fe13a4fa5b
      EXAMPLE_LANGUAGE=python python -m pytest -q task-checks/code-example-list-bounties/test_list_bounties.py
    • Check output:
      .                                       [100%]
      1 passed in 11.74s
      
  2. Repository integrity checks:
    • git diff --check: Clean (no trailing whitespace or formatting issues).
    • Scope check (git status --short):
       M README.md
      ?? python-bounties/
      

Copilot AI balanced review requested due to automatic review settings November 13, 2026 08:19

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[$2 site credit] Add a Python example that lists open bounties

2 participants