beatsaber-playlist-tool/docs/prompts/02-sample-usage.md

42 lines
14 KiB
Markdown
Raw Normal View History

We have some sample usage of this library here:
```
In [40]: client = ScoreSaberClient(base_url="https://scoresaber.com")
...:
...: player_id = '76561199407393962'
...:
...: player_score_collection: PlayerScoreCollection = get_api_player_player_id_scores.sync(
...: client=client,
...: player_id=player_id,
...: # page=1,
...: # limit=50,
...: # sort='recent'
...: )
...:
2024-09-30 09:30:49 DEBUG: load_ssl_context verify=True cert=None trust_env=True http2=False
2024-09-30 09:30:49 DEBUG: load_verify_locations cafile='/home/blee/ops/beatsaber/playlist-tool/.venv/lib/python3.11/site-packages/certifi/cacert.pem'
2024-09-30 09:30:49 DEBUG: connect_tcp.started host='scoresaber.com' port=443 local_address=None timeout=None socket_options=None
2024-09-30 09:30:49 DEBUG: connect_tcp.complete return_value=<httpcore._backends.sync.SyncStream object at 0x7fcc7be40c90>
2024-09-30 09:30:49 DEBUG: start_tls.started ssl_context=<ssl.SSLContext object at 0x7fcc81720170> server_hostname='scoresaber.com' timeout=None
2024-09-30 09:30:49 DEBUG: start_tls.complete return_value=<httpcore._backends.sync.SyncStream object at 0x7fcc7be41b10>
2024-09-30 09:30:49 DEBUG: send_request_headers.started request=<Request [b'GET']>
2024-09-30 09:30:49 DEBUG: send_request_headers.complete
2024-09-30 09:30:49 DEBUG: send_request_body.started request=<Request [b'GET']>
2024-09-30 09:30:49 DEBUG: send_request_body.complete
2024-09-30 09:30:49 DEBUG: receive_response_headers.started request=<Request [b'GET']>
2024-09-30 09:30:49 DEBUG: receive_response_headers.complete return_value=(b'HTTP/1.1', 200, b'OK', [(b'Date', b'Mon, 30 Sep 2024 16:30:49 GMT'), (b'Content-Type', b'application/json; charset=utf-8'), (b'Transfer-Encoding', b'chunked'), (b'Connection', b'keep-alive'), (b'Content-Security-Policy', b"default-src 'self';base-uri 'self';font-src 'self' https: data:;form-action 'self';frame-ancestors 'self';img-src 'self' data:;object-src 'none';script-src 'self';script-src-attr 'none';style-src 'self' https: 'unsafe-inline';upgrade-insecure-requests"), (b'Cross-Origin-Embedder-Policy', b'require-corp'), (b'Cross-Origin-Opener-Policy', b'same-origin'), (b'Cross-Origin-Resource-Policy', b'same-origin'), (b'Origin-Agent-Cluster', b'?1'), (b'Referrer-Policy', b'no-referrer'), (b'Strict-Transport-Security', b'max-age=15552000; includeSubDomains'), (b'X-Content-Type-Options', b'nosniff'), (b'X-DNS-Prefetch-Control', b'off'), (b'X-Download-Options', b'noopen'), (b'X-Frame-Options', b'SAMEORIGIN'), (b'X-Permitted-Cross-Domain-Policies', b'none'), (b'X-XSS-Protection', b'0'), (b'X-RateLimit-Limit', b'400'), (b'X-RateLimit-Remaining', b'399'), (b'X-RateLimit-Reset', b'1727713862'), (b'ETag', b'W/"3369-agcCR95tngk5ACxBE2z3E87S8IM"'), (b'CF-Cache-Status', b'DYNAMIC'), (b'Report-To', b'{"endpoints":[{"url":"https:\\/\\/a.nel.cloudflare.com\\/report\\/v4?s=3WgwWJyhnP7LHZaTLYLst9jpVmzOj5bhgASSmRqf97BJDejCgVN2K%2BD1XI79HkY4TAXyQVzNxgYWid9iMXy2lmS0q6QVpYZKakJZhoPOj1GEKQeV22VgLUfKXsgPbxK2aQ%3D%3D"}],"group":"cf-nel","max_age":604800}'), (b'NEL', b'{"success_fraction":0,"report_to":"cf-nel","max_age":604800}'), (b'Server', b'cloudflare'), (b'CF-RAY', b'8cb59986999b0cbb-LAX'), (b'Content-Encoding', b'gzip')])
2024-09-30 09:30:49 INFO: HTTP Request: GET https://scoresaber.com/api/player/76561199407393962/scores "HTTP/1.1 200 OK"
2024-09-30 09:30:49 DEBUG: receive_response_body.started request=<Request [b'GET']>
2024-09-30 09:30:49 DEBUG: receive_response_body.complete
2024-09-30 09:30:49 DEBUG: response_closed.started
2024-09-30 09:30:49 DEBUG: response_closed.complete
2024-09-30 09:30:49 DEBUG: Using selector: EpollSelector
In [41]: player_score_collection
Out[41]: PlayerScoreCollection(player_scores=[PlayerScore(score=Score(id=84950667, rank=104, base_score=1099231, modified_score=1099231, pp=341.7099, weight=1, modifiers='', multiplier=1, bad_cuts=0, missed_notes=2, max_combo=775, full_combo=False, hmd=0, has_replay=True, time_set=datetime.datetime(2024, 9, 5, 1, 8, 57, tzinfo=tzutc()), device_hmd='Vive', device_controller_left='Touch', device_controller_right='Touch', leaderboard_player_info=None), leaderboard=LeaderboardInfo(id=617336, song_hash='CEE98A6F3D644468E231D385CA609F804977583A', song_name='Unlimited Hyperlink', song_sub_name='', song_author_name='Kobaryo', level_author_name='Timbo', difficulty=Difficulty(leaderboard_id=617336, difficulty=5, game_mode='SoloStandard', difficulty_raw='_Hard_SoloStandard'), max_score=1165755, created_date=datetime.datetime(2024, 7, 20, 0, 17, 12, tzinfo=tzutc()), ranked_date=datetime.datetime(2024, 9, 2, 17, 38, 15, tzinfo=tzutc()), qualified_date=datetime.datetime(2024, 8, 4, 7, 39, 33, tzinfo=tzutc()), loved_date=None, ranked=True, qualified=False, loved=False, max_pp=-1, stars=8.46, positive_modifiers=False, plays=357, daily_plays=10, cover_image='https://cdn.scoresaber.com/covers/CEE98A6F3D644468E231D385CA609F804977583A.png', player_score=None, difficulties=[], additional_properties={})), PlayerScore(score=Score(id=84877397, rank=556, base_score=1440841, modified_score=1440841, pp=313.5614, weight=0.965, modifiers='', multiplier=1, bad_cuts=1, missed_notes=1, max_combo=979, full_combo=False, hmd=0, has_replay=False, time_set=datetime.datetime(2024, 9, 3, 0, 40, 42, tzinfo=tzutc()), device_hmd='Vive', device_controller_left='Touch', device_controller_right='Touch', leaderboard_player_info=None), leaderboard=LeaderboardInfo(id=292442, song_hash='5EEA46E777960913951ED9D0257404CC3A1BE305', song_name='Memecore', song_sub_name='', song_author_name='HiTECH NINJA', level_author_name='FatBeanzoop', difficulty=Difficulty(leaderboard_id=292442, difficulty=7, game_mode='SoloStandard', difficulty_raw='_Expert_SoloStandard'), max_score=1541115, created_date=datetime.datetime(2020, 9, 10, 3, 12, 50, tzinfo=tzutc()), ranked_date=datetime.datetime(2020, 9, 15, 9, 27, 51, tzinfo=tzutc()), qualified_date=datetime.datetime(2020, 9, 10, 16, 7, 16, tzinfo=tzutc()), loved_date=None, ranked=True, qualified=False, loved=False, max_pp=-1, stars=8.07, positive_modifiers=False, plays=5560, daily_plays=4, cover_image='https://cdn.scoresaber.com/covers/5EEA46E777960913951ED9D0257404CC3A1BE305.png', player_score=None, difficulties=[], additional_properties={})), PlayerScore(score=Score(id=83361463, rank=132, base_score=1363346, modified_score=1363346, pp=306.9723, weight=0.931225, modifiers='', multiplier=1, bad_cuts=0, missed_notes=0, max_combo=1572, full_combo=True, hmd=0, has_replay=True, time_set=datetime.datetime(2024, 8, 15, 23, 10, 29, tzinfo=tzutc()), device_hmd='Vive', device_controller_left='Touch', device_controller_right='Touch', leaderboard_player_info=None), leaderboard=LeaderboardInfo(id=299718, song_hash='A51425319D892986A4867388153BCE45B3C28483', song_name='Shake The Ground', song_sub_name='(feat. Sullivan King & Jonah Kay)', song_author_name='Kill The Noise & SNAILS', level_author_name='Checkthepan', difficulty=Difficulty(leaderboard_id=299718, difficulty=7, game_mode='SoloStandard', difficulty_raw='_Expert_SoloStandard'), max_score=1438995, created_date=datetime.datetime(2020, 10, 9, 0, 26, 9, tzinfo=tzutc()), ranked_date=datetime.datetime(2020, 10, 16, 15, 28, 19, tzinfo=tzutc()), qualified_date=datetime.datetime(2020, 10, 11, 16, 10, 9, tzinfo=tzutc()), loved_date=None, ranked=True, qualified=False, loved=False, max_pp=-1, stars=7.4, positive_modifiers=False, plays=3317, daily_plays=1, cover_image='https://cdn.scoresaber.com/covers/A51425319D892986A4867388153BCE45B3C28483.png', player_score=None, difficulties=[], additional_properties={})), PlayerScore(score=Score(id=83135043, rank=512, base_score=884286, modified_score=884286, pp=302.4246, weight=0.8986321249999999, modifiers='', multiplier=1, bad_cuts=0, missed_notes=2, max_combo=79
2024-09-30 09:31:03 DEBUG: Using selector: EpollSelector
```