modify set ver1
This commit is contained in:
1 parent
19bd12d581
commit
08d47a6990
21 files changed
+2435
-398
No files matched your search
+22
-8
@@ -9,8 +9,7 @@ import asyncio
|
||||
import logging
|
||||
import sys
|
||||
|
||||
from poc.instagram.client import InstagramClient
|
||||
from poc.instagram.exceptions import InstagramAPIError
|
||||
from poc.instagram import InstagramClient, ErrorState, parse_instagram_error
|
||||
|
||||
# 로깅 설정
|
||||
logging.basicConfig(
|
||||
@@ -42,8 +41,12 @@ async def main():
|
||||
account_id = await client.get_account_id()
|
||||
print("[성공] 접속 확인 완료")
|
||||
print(f" Account ID: {account_id}")
|
||||
except InstagramAPIError as e:
|
||||
print(f"[실패] 접속 실패: {e}")
|
||||
except Exception as e:
|
||||
error_state, message, extra_info = parse_instagram_error(e)
|
||||
if error_state == ErrorState.AUTH_ERROR:
|
||||
print(f"[실패] 인증 실패: {message}")
|
||||
else:
|
||||
print(f"[실패] 접속 실패: {message}")
|
||||
return
|
||||
|
||||
# Step 2: 비디오 업로드
|
||||
@@ -62,8 +65,18 @@ async def main():
|
||||
print("\n[성공] 비디오 업로드 완료!")
|
||||
print(f" 미디어 ID: {media.id}")
|
||||
print(f" 링크: {media.permalink}")
|
||||
except InstagramAPIError as e:
|
||||
print(f"\n[실패] 업로드 실패: {e}")
|
||||
except Exception as e:
|
||||
error_state, message, extra_info = parse_instagram_error(e)
|
||||
if error_state == ErrorState.RATE_LIMIT:
|
||||
retry_after = extra_info.get("retry_after", 60)
|
||||
print(f"\n[실패] Rate Limit: {message} (재시도: {retry_after}초)")
|
||||
elif error_state == ErrorState.CONTAINER_TIMEOUT:
|
||||
print(f"\n[실패] 타임아웃: {message}")
|
||||
elif error_state == ErrorState.CONTAINER_ERROR:
|
||||
status = extra_info.get("status", "UNKNOWN")
|
||||
print(f"\n[실패] 컨테이너 에러: {message} (상태: {status})")
|
||||
else:
|
||||
print(f"\n[실패] 업로드 실패: {message}")
|
||||
return
|
||||
|
||||
# Step 3: 업로드 확인
|
||||
@@ -79,8 +92,9 @@ async def main():
|
||||
print(f" 게시일: {verified_media.timestamp}")
|
||||
if verified_media.caption:
|
||||
print(f" 캡션: {verified_media.caption}")
|
||||
except InstagramAPIError as e:
|
||||
print(f"[실패] 확인 실패: {e}")
|
||||
except Exception as e:
|
||||
error_state, message, _ = parse_instagram_error(e)
|
||||
print(f"[실패] 확인 실패: {message}")
|
||||
return
|
||||
|
||||
print("\n" + "=" * 60)
|
||||
|
||||
Reference in new issue
Block a user