@dataclassclassOpenAICodexToken:"""Stored OAuth token data for OpenAI Codex."""access_token:strrefresh_token:strexpires_at:floataccount_id:strdefis_expired(self,buffer_seconds:int=300)->bool:"""Check if the token is expired or about to expire."""returntime.time()>=(self.expires_at-buffer_seconds)defto_dict(self)->dict[str,str|float]:return{"access_token":self.access_token,"refresh_token":self.refresh_token,"expires_at":self.expires_at,"account_id":self.account_id,}@classmethoddeffrom_dict(cls,data:dict[str,str|float])->Self:returncls(access_token=str(data["access_token"]),refresh_token=str(data["refresh_token"]),expires_at=float(data["expires_at"]),account_id=str(data["account_id"]),)
defis_expired(self,buffer_seconds:int=300)->bool:"""Check if the token is expired or about to expire."""returntime.time()>=(self.expires_at-buffer_seconds)