유럽에서 개조된 Steam Deck을 확보하는 것은 재고 변동으로 인해 어려울 수 있습니다. 이 Python 기반 가용성 검사기는 프로세스를 자동화하여 리퍼브 유닛이 나타날 때 실시간 알림을 제공합니다. 이 게시물은 프로젝트의 기술 구현을 자세히 설명하고 커뮤니티 기여를 장려합니다.
사업개요
이 Python 스크립트는 유럽에서 Steam Deck의 리퍼브 가용성을 확인하기 위해 Steam 매장을 모니터링합니다. ntfy 알림 서비스를 활용하면 재고가 확보되면 즉시 사용자에게 알립니다. 이 프로젝트는 쉽게 사용할 수 있는 Python 라이브러리와 API를 사용하여 효율적인 문제 해결 방법을 보여줍니다.
기능
스크립트는 다음과 같이 작동합니다.
핵심 로직:
from urllib.request import urlopen # Configure your ntfy URL ntfy_url = "ntfy.sh/YOUR_NTFY_URL" # Timeout to prevent script hang-ups timeout = 8 def parse_availability(data: bytes) -> bool: parsed = " ".join(f"{c:02X}" for c in data) not_available = "08 00 10 00" return parsed != not_available def is_available(id_: str) -> bool: url = ( "api.steampowered.com/IPhysicalGoodsService/" "CheckInventoryAvailableByPackage/v1?origin=" f"https://store.steampowered.com&input_protobuf_encoded={id_}" ) with urlopen(f"https://{url}", timeout=timeout) as response: data = response.read() return parse_availability(data) def notify(name: str) -> None: message = f"Refurbished {name} Steam Deck is available!" print(message) with urlopen(f"https://{ntfy_url}", data=str.encode(message), timeout=timeout): pass if __name__ == "__main__": # Uncomment for notification testing # notify("TEST") # Refurbished 64GB (European region, tested in Poland) if is_available("COGVNxICUEw="): notify("64GB")
실행
ntfy_url
을 개인 ntfy URL로 바꾸세요(ntfy 웹사이트에서 얻으세요). 알림을 받으려면 ntfy 모바일 앱을 권장합니다.ntfy.sh
및 api.steampowered.com
를 신뢰할 수 있는 사이트에 추가하세요.결론
이 프로젝트는 실용적인 작업을 위한 간결한 Python 스크립트의 힘을 강조합니다. API 상호 작용, 알림 및 Python 자동화를 위한 귀중한 학습 리소스 역할을 합니다. 전체 코드는 GitHub에서 제공되며 기여와 사용자 정의를 환영합니다.
위 내용은 유럽에서 개조된 Steam 데크에 대한 가용성 검사기 구축의 상세 내용입니다. 자세한 내용은 PHP 중국어 웹사이트의 기타 관련 기사를 참조하세요!