GrabzIt Python API 앱에서 기존 스크린 샷의 상태를 확인하고 GrabzIt에서 사용하는 쿠키를 응용 프로그램에서 설정하도록 허용하는 등 많은 고급 기능이 있습니다.
응용 프로그램이 스크린 샷 상태를 확인하려면 GetStatus 메서드를 사용하십시오. 캡처가 여전히 처리 중인지, 오류 메시지가 있는지, 캐시되었는지 또는 만료되었는지를 나타내는 상태 오브젝트를 리턴합니다.
from GrabzIt import GrabzItClient grabzIt = GrabzItClient.GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret") status = grabzIt.GetStatus(screenShotId) if status.processing: # screenshot has not yet been processed if status.cached: # screenshot is still cached by GrabzIt if status.expired: # screenshot is no longer on GrabzIt # Perhaps output status message? raise Exception(status.Message)
많은 웹 사이트가 쿠키를 통해 웹 페이지 기능을 제어합니다. GrabzIt은 다음과 같은 방법으로 개발자가 정의한 쿠키를 설정할 수 있습니다.
from GrabzIt import GrabzItClient grabzIt = GrabzItClient.GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret") # gets an array of cookies for google.com cookies = grabzIt.GetCookies("google.com") # sets a cookie for the google.com domain grabzIt.SetCookie("MyCookie", "google.com", "Any Value You Like") # deletes the previously set cookie grabzIt.DeleteCookie("MyCookie", "google.com")
이것은 쿠키 기능에 대한 좋은 개요이지만 쿠키 방법에는 클라이언트 문서.
권장되는 캡처는 사용하기 전에 웹 서버에 다운로드됩니다. 웹 서버에 먼저 다운로드하지 않고도 사용자의 브라우저에 모든 유형의 캡처를 표시 할 수 있습니다.
이렇게하려면 캡처가 완료된 후 캡처 한 바이트를 보낼 수 있습니다. SaveTo 방법 응답과 함께 올바른 마임 유형.
from GrabzIt import GrabzItClient grabzIt = GrabzItClient.GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret") grabzIt.URLToImage("https://www.tesla.com") capture = grabzIt.SaveTo()
위의 예에서는 캡처 바이트를 가져 오지만 응답으로 리턴되는 방법은 사용중인 프레임 워크에 따라 다릅니다.