Skip to main content

Python client SDK for contest-server

Project description

contest-client

Python SDK for the contest-server.

Install (dev)

cd contest_client
python -m venv .venv
source .venv/bin/activate
pip install -U pip
pip install -e .

Usage

サーバー側で用意されたコンテスト(contest_id は運営が contest-provision --spec ... 実行時の出力から取得し、必要な範囲で配布する想定)に対して、ユーザー登録・ログイン・提出を行うシナリオをサポートします。コンテスト作成や参加者(チーム)作成はクライアントからできません。

from contest_client import ContestClient

c = ContestClient("http://127.0.0.1:8000")

# contest_id は運営から共有済み
contest_id = "cst_xxxxxx"

# 1) 初回登録
reg = c.register_user(contest_id, user_name="alice", password="secret123")
print("user_id:", reg["user_id"])
print("api_key (use for submissions):", reg["api_key"])

# 2) ログイン(APIキーをローテーションして取得)
login = c.login(contest_id, user_name="alice", password="secret123")
api_key = login["api_key"]

# 3) 提出
res = c.submit(contest_id, user_name="alice", api_key=api_key, x={"x1": 0.1, "x2": 0.7, "x3": 0.9})
print(res)

print(c.leaderboard(contest_id))

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ynu_m_contest_client-0.1.1.tar.gz (2.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ynu_m_contest_client-0.1.1-py3-none-any.whl (2.9 kB view details)

Uploaded Python 3

File details

Details for the file ynu_m_contest_client-0.1.1.tar.gz.

File metadata

  • Download URL: ynu_m_contest_client-0.1.1.tar.gz
  • Upload date:
  • Size: 2.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for ynu_m_contest_client-0.1.1.tar.gz
Algorithm Hash digest
SHA256 544457c6e5a7d8292aa9065beb99c9ba17eb262708651b8622f2d5dfdf08c7b3
MD5 c66d491839839e68988da2269eeaffb9
BLAKE2b-256 fb8f7b18463ba5944e8862437bf56de602c413b6c5a0eb0d27811b19204880db

See more details on using hashes here.

File details

Details for the file ynu_m_contest_client-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for ynu_m_contest_client-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ef912325917939711765b3415f08ad422b764f4392a9272b2dcee1c8f5b281ef
MD5 1b4eb8c669ddf24fdf64640b1dd7c2cd
BLAKE2b-256 ed0c0a929c28090fa9af800fc4cb06be8b7f2a884098ad8ac9e07d7f7dcacbdb

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page