Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

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

Spore REST API client

License

NotificationsYou must be signed in to change notification settings

LEv145/spore.py

Repository files navigation

LicensePython

How to use

> spore_cli.exe --helpUsage: spore_cli [OPTIONS] COMMAND [ARGS]...  CLI for Spore REST APIOptions:  --help  Show this message and exit.Commands:  get-asset-comments     Get comments of the asset  get-asset-info         Get asset information  get-creature           Get creature  get-sporecast-assets   Get assets of the sporecast  get-stats              Get stats  get-user-achievements  Get achievements of the user  get-user-assets        Get creature of the user  get-user-buddies       Get buddies of the user  get-user-info          Get user information  get-user-sporecasts    Get sporecasts of the user  get-user-subscribers   Get subscribers of the user  search-assets          Search assets> spore_cli.exe search-assets --helpUsage: spore_cli search-assets [OPTIONS] {top_rated|top_rated_new|newest|featu                               red|maxis_made|random|cute_and_creepy}                               [START_INDEX] [LENGTH]                               [[building|creature|vehicle|adventure|ufo]]  Search assetsOptions:  --help  Show this message and exit.> spore_cli.exe get-creature 500267423060  # Get json info of creature{"asset_id": 500267423060, "cost": 4065, "health": 3.0, "height": 1.3428643, "meanness": 9.0, "cuteness": 71.26385, "sense": 1.0, "bonecount": 44.0, "footcount": 4.0, "graspercount": 0.0, "basegear": 0.0, "carnivore": 1.0, "herbivore": 0.0, "glide": 0.0, "sprint": 2.0, "stealth": 2.0, "bite": 3.0, "charge": 2.0, "strike": 4.0, "spit": 0.0, "sing": 1.0, "dance": 2.0, "gesture": 5.0, "posture": 0.0}

Build

Build binary:

make installmake binary

Build for python (requires Python 3.7+)

pip install --editable .

Work in Python

Install

pipinstallgit+https://github.com/LEv145/spore.py

Or from pypi

pipinstallspore.py

Simple examples

importasynciofromspore_apiimportSporeClientasyncdefmain()->None:asyncwithSporeClient()asclient:print(awaitclient.get_creature(500267423060))asyncio.run(main())

In sync code:

importasynciofromspore_apiimportSporeClientasyncdefclient_logic()->str:asyncwithSporeClient()asclient:result=awaitclient.get_creature(500267423060)returnresult.to_json()defmain()->None:loop=asyncio.get_event_loop()result=loop.run_until_complete(client_logic())print(f"Json result:{result!r}")main()

Client methods

get_stats()->Statsget_creature(asset_id:int|str)->Creatureget_user_info(username:str)->Userget_user_assets(username:str,start_index:int|str,length:int|str)->Assetsget_user_sporecasts(username:str)->Sporecasts:get_sporecast_assets(sporecast_id:int|str,start_index:int|str,length:int|str)->SporecastAssetsget_user_achievements(username:str,start_index:int|str,length:int|str)->Achievementsget_asset_info(asset_id:int|str)->FullAssetget_asset_comments(asset_id:int|str,start_index:int|str,length:int|str)->AssetCommentsget_user_buddies(username:str,start_index:int|str,length:int|str)->Buddiesget_user_subscribers(username:str,start_index:int|str,length:int|str)->Buddiesassets_search(view_type:ViewType,start_index:int|str,length:int|str,asset_type:AssetType|None=None)->Assets

TODO:

  • Tests
  • IMPLEMENTATION.md

[8]ページ先頭

©2009-2025 Movatter.jp