### Install SIMNet Package Source: https://context7.com/paigramteam/simnet/llms.txt Installs the SIMNet library using pip. This is the first step to using the API wrapper. ```bash pip install simnet ``` -------------------------------- ### Get Star Rail User Data with SIMNet (Python) Source: https://github.com/paigramteam/simnet/blob/main/README.md This example demonstrates how to use the SIMNet library to fetch user data for Honkai: Star Rail. It requires valid user cookies and a player ID. The function returns user statistics, including the total number of characters owned. ```python import asyncio import simnet async def main(): cookies = {} # write your cookies player_id = 123456789 async with simnet.StarRailClient(cookies, player_id=player_id) as client: data = await client.get_starrail_user() print(f"Player has a total of {data.stats.avatar_num} characters") asyncio.run(main()) ``` -------------------------------- ### Get ZZZ Notes - Python Source: https://context7.com/paigramteam/simnet/llms.txt Retrieves real-time game status for Zenless Zone Zero, including battery charge and scratch card status. Requires the simnet library and user cookies. ```python import asyncio import simnet async def main(): cookies = {"ltuid": "YOUR_LTUID", "ltoken": "YOUR_LTOKEN"} async with simnet.ZZZClient(cookies=cookies, player_id=1000000001) as client: notes = await client.get_zzz_notes() print(f"Battery: {notes.energy.progress.current}/{notes.energy.progress.max}") print(f"Engagement: {notes.vitality.current}/{notes.vitality.max}") asyncio.run(main()) ``` -------------------------------- ### Utilize Region and Game Enums in SIMNet Source: https://context7.com/paigramteam/simnet/llms.txt Shows how to use the Region and Game enums provided by SIMNet for specifying game regions and supported games. Includes examples for Genshin Impact, Honkai: Star Rail, Zenless Zone Zero, and Honkai Impact 3rd. ```python from simnet.utils.enums import Region, Game # Regions print(Region.OVERSEAS) # "os" - HoYoLab (Global) print(Region.CHINESE) # "cn" - miHoYo (China) # Games print(Game.GENSHIN) # "genshin" - Genshin Impact print(Game.STARRAIL) # "hkrpg" - Honkai: Star Rail print(Game.ZZZ) # "nap" - Zenless Zone Zero print(Game.HONKAI) # "honkai3rd" - Honkai Impact 3rd # Usage example import simnet async def example(): async with simnet.GenshinClient( cookies={}, player_id=700000001, region=Region.OVERSEAS, # or Region.CHINESE for CN server ) as client: pass ``` -------------------------------- ### GET /genshin/monthly_rewards Source: https://context7.com/paigramteam/simnet/llms.txt Retrieves the list of all rewards available for the current month in Genshin Impact's daily check-in. This provides details for each day's reward. ```APIDOC ## GET /genshin/monthly_rewards ### Description Retrieves the list of all rewards available for the current month. This provides details for each day's reward. ### Method GET ### Endpoint /genshin/monthly_rewards ### Parameters #### Query Parameters - **cookies** (object) - Required - Authentication cookies (ltuid, ltoken). - **player_id** (integer) - Required - The player's unique ID. ### Request Example ```python import asyncio import simnet async def main(): cookies = {"ltuid": "YOUR_LTUID", "ltoken": "YOUR_LTOKEN"} async with simnet.GenshinClient(cookies=cookies, player_id=700000001) as client: rewards = await client.get_monthly_rewards() print("Monthly Rewards:") for i, reward in enumerate(rewards, 1): print(f" Day {i}: {reward.name} x{reward.amount}") asyncio.run(main()) ``` ### Response #### Success Response (200) - **rewards** (array) - List of reward objects for the month. - **name** (string) - Name of the reward item. - **amount** (integer) - Amount of the reward item. #### Response Example ```json [ { "name": "Mora", "amount": 10000 }, { "name": "Primogem", "amount": 20 } ] ``` ``` -------------------------------- ### Get Star Rail Notes - Python Source: https://context7.com/paigramteam/simnet/llms.txt Retrieves real-time game status for Honkai: Star Rail, including trailblaze power, daily training progress, and assignment statuses. Requires simnet library and user cookies. ```python import asyncio import simnet async def main(): cookies = {"ltuid": "YOUR_LTUID", "ltoken": "YOUR_LTOKEN"} async with simnet.StarRailClient(cookies=cookies, player_id=800000001) as client: notes = await client.get_starrail_notes() print(f"Trailblaze Power: {notes.current_stamina}/{notes.max_stamina}") print(f"Recovery Time: {notes.stamina_recover_time}") print(f"Daily Training: {notes.current_train_score}/{notes.max_train_score}") print(f"Simulated Universe: {notes.current_rogue_score}/{notes.max_rogue_score}") print("\nAssignments:") for assignment in notes.expeditions: print(f" - Status: {assignment.status}, Remaining: {assignment.remaining_time}") asyncio.run(main()) ``` -------------------------------- ### GET /starrail/characters Source: https://context7.com/paigramteam/simnet/llms.txt Retrieves detailed character information for Honkai: Star Rail. This endpoint allows fetching a list of characters with their attributes, levels, equipment, and more. ```APIDOC ## GET /starrail/characters ### Description Retrieves detailed character information for Honkai: Star Rail. This endpoint allows fetching a list of characters with their attributes, levels, equipment, and more. ### Method GET ### Endpoint /starrail/characters ### Parameters #### Query Parameters - **cookies** (object) - Required - Authentication cookies (ltuid, ltoken). - **player_id** (integer) - Required - The player's unique ID. ### Request Example ```python import asyncio import simnet async def main(): cookies = {"ltuid": "YOUR_LTUID", "ltoken": "YOUR_LTOKEN"} async with simnet.StarRailClient(cookies=cookies, player_id=800000001) as client: characters = await client.get_starrail_characters() for char in characters.avatar_list[:5]: print(f"\n{char.name} (Lv.{char.level})") print(f" Rarity: {char.rarity} stars") print(f" Rank: E{char.rank}") print(f" Element: {char.element}") print(f" Path: {char.path}") if char.equip: print(f" Light Cone: {char.equip.name} (Lv.{char.equip.level})") asyncio.run(main()) ``` ### Response #### Success Response (200) - **avatar_list** (array) - List of character objects. - **name** (string) - Character's name. - **level** (integer) - Character's level. - **rarity** (integer) - Character's rarity (number of stars). - **rank** (integer) - Character's constellation rank. - **element** (string) - Character's element. - **path** (string) - Character's path. - **equip** (object) - Equipped Light Cone information. - **name** (string) - Light Cone's name. - **level** (integer) - Light Cone's level. #### Response Example ```json { "avatar_list": [ { "name": "Trailblaze", "level": 80, "rarity": 5, "rank": 6, "element": "Fire", "path": "Destruction", "equip": { "name": "On the Fall of an Aeon", "level": 80 } } ] } ``` ``` -------------------------------- ### GET /genshin/reward_info Source: https://context7.com/paigramteam/simnet/llms.txt Retrieves information about the current daily reward status for Genshin Impact. This includes whether the reward has been signed in for today and the total count for the month. ```APIDOC ## GET /genshin/reward_info ### Description Retrieves information about the current daily reward status including days signed in. This includes whether the reward has been signed in for today and the total count for the month. ### Method GET ### Endpoint /genshin/reward_info ### Parameters #### Query Parameters - **cookies** (object) - Required - Authentication cookies (ltuid, ltoken). - **player_id** (integer) - Required - The player's unique ID. ### Request Example ```python import asyncio import simnet async def main(): cookies = {"ltuid": "YOUR_LTUID", "ltoken": "YOUR_LTOKEN"} async with simnet.GenshinClient(cookies=cookies, player_id=700000001) as client: info = await client.get_reward_info() print(f"Signed in today: {info.signed_in}") print(f"Total sign-ins this month: {info.claimed_rewards}") asyncio.run(main()) ``` ### Response #### Success Response (200) - **signed_in** (boolean) - True if the reward has been signed in for today, false otherwise. - **claimed_rewards** (integer) - The total number of rewards claimed this month. #### Response Example ```json { "signed_in": true, "claimed_rewards": 15 } ``` ``` -------------------------------- ### Retrieve HoYoLab Game Record Card with Python Source: https://context7.com/paigramteam/simnet/llms.txt This Python code snippet demonstrates how to fetch a user's HoYoLab game record card using the simnet library. It requires authentication cookies and a player ID. The function returns a card object containing game details, user information, and specific game data fields. Ensure you have the `simnet` and `asyncio` libraries installed. ```python import asyncio import simnet async def main(): cookies = {"ltuid": "YOUR_LTUID", "ltoken": "YOUR_LTOKEN"} async with simnet.GenshinClient(cookies=cookies, player_id=700000001) as client: card = await client.get_record_card() if card: print(f"Game: {card.game}") print(f"UID: {card.uid}") print(f"Nickname: {card.nickname}") print(f"Level: {card.level}") print(f"Region: {card.region_name}") print("\nData Fields:") for field in card.data: print(f" {field.name}: {field.value}") asyncio.run(main()) ``` -------------------------------- ### Get Monthly Reward List - Python Source: https://context7.com/paigramteam/simnet/llms.txt Retrieves the list of all rewards available for the current month in Genshin Impact using the simnet library. Requires authentication cookies and player ID. Outputs a list of rewards, detailing the name and amount for each day of the month. ```python import asyncio import simnet async def main(): cookies = {"ltuid": "YOUR_LTUID", "ltoken": "YOUR_LTOKEN"} async with simnet.GenshinClient(cookies=cookies, player_id=700000001) as client: rewards = await client.get_monthly_rewards() print("Monthly Rewards:") for i, reward in enumerate(rewards, 1): print(f" Day {i}: {reward.name} x{reward.amount}") asyncio.run(main()) ``` -------------------------------- ### GET /starrail/warp_history Source: https://context7.com/paigramteam/simnet/llms.txt Retrieves warp history for Honkai: Star Rail. This endpoint fetches past warps from specified banner types, allowing filtering by rarity. ```APIDOC ## GET /starrail/warp_history ### Description Retrieves warp history for Honkai: Star Rail. This endpoint fetches past warps from specified banner types, allowing filtering by rarity. ### Method GET ### Endpoint /starrail/warp_history ### Parameters #### Query Parameters - **cookies** (object) - Required - Authentication cookies (ltuid, ltoken). - **player_id** (integer) - Required - The player's unique ID. - **authkey** (string) - Required - Authentication key obtained from game logs. - **banner_types** (array of integers) - Optional - List of banner types to retrieve warps from (e.g., 1=Stellar, 2=Departure, 11=Character, 12=Light Cone). - **limit** (integer) - Optional - The maximum number of warps to retrieve. ### Request Example ```python import asyncio import simnet async def main(): cookies = {"ltuid": "YOUR_LTUID", "ltoken": "YOUR_LTOKEN"} authkey = "YOUR_AUTHKEY_FROM_GAME_LOGS" async with simnet.StarRailClient(cookies=cookies, player_id=800000001) as client: # Banner types: 1=Stellar, 2=Departure, 11=Character, 12=Light Cone warps = await client.wish_history( banner_types=[11], # Character Event Warp limit=100, authkey=authkey ) print(f"Total warps retrieved: {len(warps)}") five_stars = [w for w in warps if w.rarity == 5] print(f"\n5-star pulls ({len(five_stars)}):") for warp in five_stars: print(f" {warp.time}: {warp.name} ({warp.item_type})") asyncio.run(main()) ``` ### Response #### Success Response (200) - **warps** (array) - List of warp objects. - **time** (string) - Timestamp of the warp. - **name** (string) - Name of the item warped for. - **rarity** (integer) - Rarity of the item (3, 4, or 5 stars). - **item_type** (string) - Type of item warped (Character or Light Cone). #### Response Example ```json [ { "time": "2023-10-27 10:00:00", "name": "Silver Wolf", "rarity": 5, "item_type": "Character" } ] ``` ``` -------------------------------- ### Get Genshin Characters Data - Python Source: https://context7.com/paigramteam/simnet/llms.txt Retrieves detailed character information for Genshin Impact, including equipment, artifacts, and constellations. Requires the simnet library and user cookies. ```python import asyncio import simnet async def main(): cookies = {"ltuid": "YOUR_LTUID", "ltoken": "YOUR_LTOKEN"} async with simnet.GenshinClient(cookies=cookies, player_id=700000001) as client: characters = await client.get_genshin_characters() for char in characters[:5]: # Show first 5 characters print(f"\n{char.name} (Lv.{char.level})") print(f" Element: {char.element}") print(f" Rarity: {char.rarity} stars") print(f" Friendship: {char.friendship}") print(f" Constellation: C{char.constellation}") if char.weapon: print(f" Weapon: {char.weapon.name} (Lv.{char.weapon.level}, R{char.weapon.refinement})") asyncio.run(main()) ``` -------------------------------- ### GET /genshin/wish_history Source: https://context7.com/paigramteam/simnet/llms.txt Retrieves wish history for Genshin Impact. This endpoint fetches past wishes from specified banner types, allowing filtering by rarity and other criteria. ```APIDOC ## GET /genshin/wish_history ### Description Retrieves wish history for Genshin Impact using an authkey from the game logs. This endpoint fetches past wishes from specified banner types, allowing filtering by rarity and other criteria. ### Method GET ### Endpoint /genshin/wish_history ### Parameters #### Query Parameters - **cookies** (object) - Required - Authentication cookies (ltuid, ltoken). - **player_id** (integer) - Required - The player's unique ID. - **authkey** (string) - Required - Authentication key obtained from game logs. - **banner_types** (array of integers) - Optional - List of banner types to retrieve wishes from (e.g., 100=Novice, 200=Permanent, 301=Character Event, 302=Weapon, 500=Chronicled). - **limit** (integer) - Optional - The maximum number of wishes to retrieve. ### Request Example ```python import asyncio import simnet async def main(): cookies = {"ltuid": "YOUR_LTUID", "ltoken": "YOUR_LTOKEN"} authkey = "YOUR_AUTHKEY_FROM_GAME_LOGS" async with simnet.GenshinClient(cookies=cookies, player_id=700000001) as client: # Get wishes from specific banner types # 100=Novice, 200=Permanent, 301=Character Event, 302=Weapon, 500=Chronicled wishes = await client.wish_history( banner_types=[301], # Character Event Banner limit=100, authkey=authkey ) print(f"Total wishes retrieved: {len(wishes)}") five_stars = [w for w in wishes if w.rarity == 5] print(f"\n5-star pulls ({len(five_stars)}):") for wish in five_stars: print(f" {wish.time}: {wish.name} ({wish.type})") four_stars = [w for w in wishes if w.rarity == 4] print(f"\n4-star pulls: {len(four_stars)}") asyncio.run(main()) ``` ### Response #### Success Response (200) - **wishes** (array) - List of wish objects. - **time** (string) - Timestamp of the wish. - **name** (string) - Name of the item wished for. - **rarity** (integer) - Rarity of the item (3, 4, or 5 stars). - **type** (string) - Type of banner the wish was made on. #### Response Example ```json [ { "time": "2023-10-27 10:00:00", "name": "Ganyu", "rarity": 5, "type": "Character Event Wish" } ] ``` ``` -------------------------------- ### Get Star Rail Memory of Chaos Data - Python Source: https://context7.com/paigramteam/simnet/llms.txt Retrieves Memory of Chaos (Forgotten Hall) challenge data for Honkai: Star Rail. Requires the simnet library and user cookies. ```python import asyncio import simnet async def main(): cookies = {"ltuid": "YOUR_LTUID", "ltoken": "YOUR_LTOKEN"} async with simnet.StarRailClient(cookies=cookies, player_id=800000001) as client: challenge = await client.get_starrail_challenge(previous=False) print(f"Season: {challenge.season}") print(f"Total Stars: {challenge.total_stars}") print(f"Max Floor: {challenge.max_floor}") print(f"Total Battles: {challenge.total_battles}") print("\nFloors:") for floor in challenge.floors: print(f" Floor {floor.name}: {floor.star_num} stars") asyncio.run(main()) ``` -------------------------------- ### Get Star Rail Characters - Python Source: https://context7.com/paigramteam/simnet/llms.txt Retrieves detailed character information for Honkai: Star Rail using the simnet library. Requires authentication cookies and player ID. Outputs character name, level, rarity, rank, element, path, and equipped Light Cone details. ```python import asyncio import simnet async def main(): cookies = {"ltuid": "YOUR_LTUID", "ltoken": "YOUR_LTOKEN"} async with simnet.StarRailClient(cookies=cookies, player_id=800000001) as client: characters = await client.get_starrail_characters() for char in characters.avatar_list[:5]: print(f"\n{char.name} (Lv.{char.level})") print(f" Rarity: {char.rarity} stars") print(f" Rank: E{char.rank}") print(f" Element: {char.element}") print(f" Path: {char.path}") if char.equip: print(f" Light Cone: {char.equip.name} (Lv.{char.equip.level})") asyncio.run(main()) ``` -------------------------------- ### Get Genshin Spiral Abyss Data - Python Source: https://context7.com/paigramteam/simnet/llms.txt Retrieves detailed Spiral Abyss performance data for Genshin Impact, including floors cleared, stars earned, and team compositions. Requires the simnet library and user cookies. ```python import asyncio import simnet async def main(): cookies = {"ltuid": "YOUR_LTUID", "ltoken": "YOUR_LTOKEN"} async with simnet.GenshinClient(cookies=cookies, player_id=700000001) as client: # Get current season abyss data abyss = await client.get_genshin_spiral_abyss(previous=False) print(f"Season: {abyss.season}") print(f"Total Battles: {abyss.total_battles}") print(f"Total Stars: {abyss.total_stars}") print(f"Max Floor: {abyss.max_floor}") if abyss.ranks.most_kills: print(f"Most Defeats: {abyss.ranks.most_kills[0].name} ({abyss.ranks.most_kills[0].value})") print("\nFloors:") for floor in abyss.floors: print(f" Floor {floor.floor}: {floor.stars}/{floor.max_stars} stars") asyncio.run(main()) ``` -------------------------------- ### Get Star Rail Warp History - Python Source: https://context7.com/paigramteam/simnet/llms.txt Retrieves warp history for Honkai: Star Rail using the simnet library. Requires authentication cookies, player ID, and an authkey from game logs. Supports filtering by banner types and limits the number of warps. Outputs warp details including time, name, and item type. ```python import asyncio import simnet async def main(): cookies = {"ltuid": "YOUR_LTUID", "ltoken": "YOUR_LTOKEN"} authkey = "YOUR_AUTHKEY_FROM_GAME_LOGS" async with simnet.StarRailClient(cookies=cookies, player_id=800000001) as client: # Banner types: 1=Stellar, 2=Departure, 11=Character, 12=Light Cone warps = await client.wish_history( banner_types=[11], # Character Event Warp limit=100, authkey=authkey ) print(f"Total warps retrieved: {len(warps)}") five_stars = [w for w in warps if w.rarity == 5] print(f"\n5-star pulls ({len(five_stars)}):") for warp in five_stars: print(f" {warp.time}: {warp.name} ({warp.item_type})") asyncio.run(main()) ``` -------------------------------- ### Get Genshin Wish History - Python Source: https://context7.com/paigramteam/simnet/llms.txt Retrieves wish history for Genshin Impact using the simnet library. Requires authentication cookies, player ID, and an authkey obtained from game logs. Allows filtering by banner types and limits the number of wishes retrieved. Outputs wish details including time, name, and type. ```python import asyncio import simnet async def main(): cookies = {"ltuid": "YOUR_LTUID", "ltoken": "YOUR_LTOKEN"} authkey = "YOUR_AUTHKEY_FROM_GAME_LOGS" async with simnet.GenshinClient(cookies=cookies, player_id=700000001) as client: # Get wishes from specific banner types # 100=Novice, 200=Permanent, 301=Character Event, 302=Weapon, 500=Chronicled wishes = await client.wish_history( banner_types=[301], # Character Event Banner limit=100, authkey=authkey ) print(f"Total wishes retrieved: {len(wishes)}") five_stars = [w for w in wishes if w.rarity == 5] print(f"\n5-star pulls ({len(five_stars)}):") for wish in five_stars: print(f" {wish.time}: {wish.name} ({wish.type})") four_stars = [w for w in wishes if w.rarity == 4] print(f"\n4-star pulls: {len(four_stars)}") asyncio.run(main()) ``` -------------------------------- ### Initialize and Use GenshinClient for Player Statistics (Python) Source: https://context7.com/paigramteam/simnet/llms.txt Demonstrates how to initialize the GenshinClient to fetch and display player statistics for Genshin Impact. Requires user cookies, player ID, region, and language. ```python import asyncio import simnet from simnet.utils.enums import Region async def main(): cookies = { "ltuid": "YOUR_LTUID", "ltoken": "YOUR_LTOKEN", } player_id = 700000001 # Your Genshin Impact UID async with simnet.GenshinClient( cookies=cookies, player_id=player_id, region=Region.OVERSEAS, lang="en-us" ) as client: # Get user statistics user = await client.get_genshin_user() print(f"Nickname: {user.info.nickname}") print(f"Level: {user.info.level}") print(f"Achievements: {user.stats.achievements}") print(f"Characters: {user.stats.characters}") print(f"Days Active: {user.stats.days_active}") print(f"Spiral Abyss: {user.stats.spiral_abyss}") asyncio.run(main()) ``` -------------------------------- ### Initialize and Use ZZZClient for Player Statistics (Python) Source: https://context7.com/paigramteam/simnet/llms.txt Demonstrates how to initialize the ZZZClient to fetch and display player statistics for Zenless Zone Zero. Requires user cookies, player ID, region, and language. ```python import asyncio import simnet from simnet.utils.enums import Region async def main(): cookies = { "ltuid": "YOUR_LTUID", "ltoken": "YOUR_LTOKEN", } player_id = 1000000001 # Your ZZZ UID async with simnet.ZZZClient( cookies=cookies, player_id=player_id, region=Region.OVERSEAS, lang="en-us" ) as client: # Get user statistics user = await client.get_zzz_user() print(f"Stats: {user.stats}") asyncio.run(main()) ``` -------------------------------- ### Initialize and Use StarRailClient for Player Statistics (Python) Source: https://context7.com/paigramteam/simnet/llms.txt Demonstrates how to initialize the StarRailClient to fetch and display player statistics for Honkai: Star Rail. Requires user cookies, player ID, region, and language. ```python import asyncio import simnet from simnet.utils.enums import Region async def main(): cookies = { "ltuid": "YOUR_LTUID", "ltoken": "YOUR_LTOKEN", } player_id = 800000001 # Your Star Rail UID async with simnet.StarRailClient( cookies=cookies, player_id=player_id, region=Region.OVERSEAS, lang="en-us" ) as client: # Get user statistics user = await client.get_starrail_user() print(f"Nickname: {user.info.nickname}") print(f"Level: {user.info.level}") print(f"Characters: {user.stats.avatar_num}") print(f"Achievements: {user.stats.achievement_num}") asyncio.run(main()) ``` -------------------------------- ### Fetch Genshin Impact Real-Time Notes (Python) Source: https://context7.com/paigramteam/simnet/llms.txt Retrieves and displays real-time game status for Genshin Impact, including resin, commissions, expeditions, and realm currency. Requires user cookies and player ID. ```python import asyncio import simnet async def main(): cookies = {"ltuid": "YOUR_LTUID", "ltoken": "YOUR_LTOKEN"} async with simnet.GenshinClient(cookies=cookies, player_id=700000001) as client: notes = await client.get_genshin_notes() print(f"Current Resin: {notes.current_resin}/{notes.max_resin}") print(f"Resin Recovery Time: {notes.resin_recovery_time}") print(f"Daily Commissions: {notes.completed_commissions}/{notes.max_commissions}") print(f"Claimed Commission Reward: {notes.claimed_commission_reward}") print(f"Realm Currency: {notes.current_realm_currency}/{notes.max_realm_currency}") print("\nExpeditions:") for expedition in notes.expeditions: print(f" - {expedition.character}: {expedition.status}") asyncio.run(main()) ``` -------------------------------- ### Retrieve Genshin Impact Primogem/Mora Income Diary Source: https://context7.com/paigramteam/simnet/llms.txt Fetches the traveler's diary containing Primogem and Mora earning details for Genshin Impact. Requires valid cookies and player ID. Outputs current and last month's earnings, and a breakdown of Primogem sources. ```python import asyncio import simnet async def main(): cookies = {"ltuid": "YOUR_LTUID", "ltoken": "YOUR_LTOKEN"} async with simnet.GenshinClient(cookies=cookies, player_id=700000001) as client: # Get current month's diary diary = await client.get_genshin_diary() print(f"UID: {diary.uid}") print(f"Month: {diary.month}") print(f"\nPrimogems:") print(f" This month: {diary.data.current_primogems}") print(f" Last month: {diary.data.last_primogems}") print(f"\nMora:") print(f" This month: {diary.data.current_mora}") print(f" Last month: {diary.data.last_mora}") print("\nPrimogem Sources:") for category in diary.data.categories: print(f" {category.name}: {category.amount} ({category.percentage}%)") asyncio.run(main()) ``` -------------------------------- ### Retrieve Honkai: Star Rail Simulated Universe Runs Source: https://context7.com/paigramteam/simnet/llms.txt Fetches Simulated Universe run data for Honkai: Star Rail. Requires valid cookies and player ID. Outputs the current score and a list of recent run scores. ```python import asyncio import simnet async def main(): cookies = {"ltuid": "YOUR_LTUID", "ltoken": "YOUR_LTOKEN"} async with simnet.StarRailClient(cookies=cookies, player_id=800000001) as client: rogue = await client.get_starrail_rogue() print(f"Current Score: {rogue.current_record.basic_score}") print("\nRecent Runs:") for record in rogue.records[:5]: print(f" World {record.progress}: Score {record.score}") asyncio.run(main()) ``` -------------------------------- ### Handle Common SIMNet API Errors Source: https://context7.com/paigramteam/simnet/llms.txt Demonstrates how to handle various exceptions provided by SIMNet for different API error scenarios. Includes handling invalid cookies, private data, account not found, rate limits, captchas, and network issues. ```python import asyncio import simnet from simnet.errors import ( InvalidCookies, DataNotPublic, AccountNotFound, TooManyRequests, AlreadyClaimed, GeetestTriggered, NeedChallenge, TimedOut, NetworkError, BadRequest, ) async def main(): cookies = {"ltuid": "YOUR_LTUID", "ltoken": "YOUR_LTOKEN"} try: async with simnet.GenshinClient(cookies=cookies, player_id=700000001) as client: user = await client.get_genshin_user() print(f"User: {user.info.nickname}") except InvalidCookies: print("Error: Cookies are invalid or expired. Please update your cookies.") except DataNotPublic: print("Error: User's Battle Chronicle is set to private.") except AccountNotFound: print("Error: Player ID not found. Check the UID.") except TooManyRequests: print("Error: Rate limited. Try again later.") except GeetestTriggered as e: print(f"Error: Captcha required - GT: {e.gt}") except NeedChallenge: print("Error: Verification challenge required.") except TimedOut: print("Error: Request timed out. Try again.") except NetworkError as e: print(f"Error: Network error occurred - {e}") except BadRequest as e: print(f"Error: API error [{e.ret_code}]: {e.message}") asyncio.run(main()) ``` -------------------------------- ### POST /genshin/claim_daily_reward Source: https://context7.com/paigramteam/simnet/llms.txt Claims the daily check-in reward from HoYoLab for Genshin Impact. This endpoint attempts to claim the reward for the current day. ```APIDOC ## POST /genshin/claim_daily_reward ### Description Claims the daily check-in reward from HoYoLab for the specified game. This endpoint attempts to claim the reward for the current day. ### Method POST ### Endpoint /genshin/claim_daily_reward ### Parameters #### Query Parameters - **cookies** (object) - Required - Authentication cookies (ltuid, ltoken). - **player_id** (integer) - Required - The player's unique ID. ### Request Example ```python import asyncio import simnet from simnet.errors import AlreadyClaimed, GeetestTriggered async def main(): cookies = {"ltuid": "YOUR_LTUID", "ltoken": "YOUR_LTOKEN"} async with simnet.GenshinClient(cookies=cookies, player_id=700000001) as client: try: reward = await client.claim_daily_reward() print(f"Claimed: {reward.name} x{reward.amount}") print(f"Icon: {reward.icon}") except AlreadyClaimed: print("Daily reward already claimed today!") except GeetestTriggered as e: print(f"Captcha required - GT: {e.gt}, Challenge: {e.challenge}") asyncio.run(main()) ``` ### Response #### Success Response (200) - **name** (string) - Name of the claimed reward. - **amount** (integer) - Amount of the claimed reward. - **icon** (string) - URL of the reward's icon. #### Error Response - **AlreadyClaimed**: Exception raised if the reward has already been claimed today. - **GeetestTriggered**: Exception raised if a Geetest captcha is required. #### Response Example (Success) ```json { "name": "Primogem", "amount": 60, "icon": "URL_TO_PRIMOGEM_ICON" } ``` ``` -------------------------------- ### Claim Daily Reward - Python Source: https://context7.com/paigramteam/simnet/llms.txt Claims the daily check-in reward for Genshin Impact using the simnet library. Requires authentication cookies and player ID. Handles `AlreadyClaimed` and `GeetestTriggered` exceptions. Outputs the claimed reward's name and amount, or an error message. ```python import asyncio import simnet from simnet.errors import AlreadyClaimed, GeetestTriggered async def main(): cookies = {"ltuid": "YOUR_LTUID", "ltoken": "YOUR_LTOKEN"} async with simnet.GenshinClient(cookies=cookies, player_id=700000001) as client: try: reward = await client.claim_daily_reward() print(f"Claimed: {reward.name} x{reward.amount}") print(f"Icon: {reward.icon}") except AlreadyClaimed: print("Daily reward already claimed today!") except GeetestTriggered as e: print(f"Captcha required - GT: {e.gt}, Challenge: {e.challenge}") asyncio.run(main()) ``` -------------------------------- ### Check Daily Reward Status - Python Source: https://context7.com/paigramteam/simnet/llms.txt Retrieves the current daily reward status for Genshin Impact using the simnet library. Requires authentication cookies and player ID. Outputs whether the user has signed in today and the total number of claimed rewards for the month. ```python import asyncio import simnet async def main(): cookies = {"ltuid": "YOUR_LTUID", "ltoken": "YOUR_LTOKEN"} async with simnet.GenshinClient(cookies=cookies, player_id=700000001) as client: info = await client.get_reward_info() print(f"Signed in today: {info.signed_in}") print(f"Total sign-ins this month: {info.claimed_rewards}") asyncio.run(main()) ``` -------------------------------- ### Retrieve Honkai: Star Rail Divergent Universe Runs Source: https://context7.com/paigramteam/simnet/llms.txt Fetches Divergent Universe (Gold and Gears) run data for Honkai: Star Rail. Requires valid cookies and player ID. Outputs the current season and participation count. ```python import asyncio import simnet async def main(): cookies = {"ltuid": "YOUR_LTUID", "ltoken": "YOUR_LTOKEN"} async with simnet.StarRailClient(cookies=cookies, player_id=800000001) as client: tourn = await client.get_starrail_rogue_tourn() print(f"Season: {tourn.schedule.season}") print(f"Participation: {tourn.basic.cnt}") asyncio.run(main()) ``` -------------------------------- ### HoYoLab Record Card API Source: https://context7.com/paigramteam/simnet/llms.txt Retrieves the HoYoLab game record card for a user's account. This endpoint allows fetching a summary of a player's game statistics. ```APIDOC ## GET /record_card ### Description Retrieves the HoYoLab game record card for a user's account. ### Method GET ### Endpoint /record_card ### Parameters #### Query Parameters - **cookies** (dict) - Required - Authentication cookies (e.g., {'ltuid': 'YOUR_LTUID', 'ltoken': 'YOUR_LTOKEN'}) - **player_id** (int) - Required - The player's unique game ID. ### Request Example ```python import asyncio import simnet async def main(): cookies = {"ltuid": "YOUR_LTUID", "ltoken": "YOUR_LTOKEN"} async with simnet.GenshinClient(cookies=cookies, player_id=700000001) as client: card = await client.get_record_card() if card: print(f"Game: {card.game}") print(f"UID: {card.uid}") print(f"Nickname: {card.nickname}") print(f"Level: {card.level}") print(f"Region: {card.region_name}") print("\nData Fields:") for field in card.data: print(f" {field.name}: {field.value}") asyncio.run(main()) ``` ### Response #### Success Response (200) - **game** (str) - The name of the game. - **uid** (int) - The player's unique game ID. - **nickname** (str) - The player's in-game nickname. - **level** (int) - The player's in-game level. - **region_name** (str) - The name of the player's game region. - **data** (list[dict]) - A list of dictionaries, where each dictionary contains 'name' (str) and 'value' (str) representing game-specific data fields. #### Response Example ```json { "game": "Genshin Impact", "uid": 700000001, "nickname": "Traveler", "level": 60, "region_name": "America", "data": [ { "name": "Abyss Floor 12 Stars", "value": "12" }, { "name": "Spiral Abyss", "value": "Completed" } ] } ``` ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.