sendgo-python 1.3.0__tar.gz → 1.4.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {sendgo_python-1.3.0 → sendgo_python-1.4.0}/PKG-INFO +28 -1
- {sendgo_python-1.3.0 → sendgo_python-1.4.0}/README.md +27 -0
- {sendgo_python-1.3.0 → sendgo_python-1.4.0}/pyproject.toml +1 -1
- {sendgo_python-1.3.0 → sendgo_python-1.4.0}/sendgo/__init__.py +2 -0
- sendgo_python-1.4.0/sendgo/account.py +77 -0
- {sendgo_python-1.3.0 → sendgo_python-1.4.0}/sendgo/client.py +7 -3
- {sendgo_python-1.3.0 → sendgo_python-1.4.0}/sendgo_python.egg-info/PKG-INFO +28 -1
- {sendgo_python-1.3.0 → sendgo_python-1.4.0}/sendgo_python.egg-info/SOURCES.txt +1 -0
- {sendgo_python-1.3.0 → sendgo_python-1.4.0}/sendgo/_payload.py +0 -0
- {sendgo_python-1.3.0 → sendgo_python-1.4.0}/sendgo/alimtalk.py +0 -0
- {sendgo_python-1.3.0 → sendgo_python-1.4.0}/sendgo/brand_message.py +0 -0
- {sendgo_python-1.3.0 → sendgo_python-1.4.0}/sendgo/brand_template.py +0 -0
- {sendgo_python-1.3.0 → sendgo_python-1.4.0}/sendgo/exceptions.py +0 -0
- {sendgo_python-1.3.0 → sendgo_python-1.4.0}/sendgo/friendtalk.py +0 -0
- {sendgo_python-1.3.0 → sendgo_python-1.4.0}/sendgo/http_client.py +0 -0
- {sendgo_python-1.3.0 → sendgo_python-1.4.0}/sendgo/kakao_image.py +0 -0
- {sendgo_python-1.3.0 → sendgo_python-1.4.0}/sendgo/kakao_sender.py +0 -0
- {sendgo_python-1.3.0 → sendgo_python-1.4.0}/sendgo/message_template.py +0 -0
- {sendgo_python-1.3.0 → sendgo_python-1.4.0}/sendgo/notice_template.py +0 -0
- {sendgo_python-1.3.0 → sendgo_python-1.4.0}/sendgo/rejected_number.py +0 -0
- {sendgo_python-1.3.0 → sendgo_python-1.4.0}/sendgo/sender_registration.py +0 -0
- {sendgo_python-1.3.0 → sendgo_python-1.4.0}/sendgo/short_url.py +0 -0
- {sendgo_python-1.3.0 → sendgo_python-1.4.0}/sendgo/sms.py +0 -0
- {sendgo_python-1.3.0 → sendgo_python-1.4.0}/sendgo/token_manager.py +0 -0
- {sendgo_python-1.3.0 → sendgo_python-1.4.0}/sendgo/webhook.py +0 -0
- {sendgo_python-1.3.0 → sendgo_python-1.4.0}/sendgo_python.egg-info/dependency_links.txt +0 -0
- {sendgo_python-1.3.0 → sendgo_python-1.4.0}/sendgo_python.egg-info/requires.txt +0 -0
- {sendgo_python-1.3.0 → sendgo_python-1.4.0}/sendgo_python.egg-info/top_level.txt +0 -0
- {sendgo_python-1.3.0 → sendgo_python-1.4.0}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: sendgo-python
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.4.0
|
|
4
4
|
Summary: Sendgo Python SDK — 카카오 알림톡/브랜드메시지, SMS/LMS/MMS
|
|
5
5
|
Author-email: Sendgo <dev@sendgo.io>
|
|
6
6
|
License: MIT
|
|
@@ -808,3 +808,30 @@ MIT License © 2026 [Sendgo](https://sendgo.io)
|
|
|
808
808
|
---
|
|
809
809
|
|
|
810
810
|
*키워드: 카카오 알림톡 Python, 카카오 친구톡 Django, SMS 발송 FastAPI, 알림톡 SDK pip, Python 카카오 API 연동, Django 문자 발송, FastAPI 알림톡, Celery 알림톡 비동기, Sendgo Python SDK*
|
|
811
|
+
|
|
812
|
+
## 계정·조직·API 키 관리 (1.4.0)
|
|
813
|
+
|
|
814
|
+
발송용 `accessKey`/`secretKey`가 없는 단계에서 사용하는 **별도 계정 클라이언트**입니다.
|
|
815
|
+
콘솔에서 발급받은 에이전트 토큰(`SENDGO_AGENT_TOKEN`)으로 `/api/v2/account`를 호출합니다.
|
|
816
|
+
계정 조회에는 `account:read`, 키·허용 IP 변경에는 `keys:write` 권한이 필요합니다.
|
|
817
|
+
토큰 만료나 권한 부족(401/403)은 그대로 예외로 반환하며 자동 갱신·재시도하지 않습니다.
|
|
818
|
+
|
|
819
|
+
조직 선택은 서버에 저장되는 **사용자 계정의 현재 조직**을 바꿉니다. 같은 사용자로
|
|
820
|
+
여러 조직의 설정을 동시에 변경하지 마세요. 개인 계정으로 돌아가려면 조직 ID에
|
|
821
|
+
`null`(Python `None`, Ruby `nil`, Go `nil`) 또는 `personal`을 전달합니다.
|
|
822
|
+
키 발급 응답의 `data.apiKey.secretKey`는 한 번만 반환되므로 서버의 비밀 저장소에 보관하세요.
|
|
823
|
+
허용 IP가 하나라도 등록되면 목록 밖의 IP는 차단됩니다.
|
|
824
|
+
에이전트 토큰과 키는 브라우저·모바일 앱에 포함하거나 응답·로그에 출력하지 않습니다.
|
|
825
|
+
|
|
826
|
+
```python
|
|
827
|
+
import os
|
|
828
|
+
from sendgo import AccountClient
|
|
829
|
+
account = AccountClient(agent_token=os.environ['SENDGO_AGENT_TOKEN'])
|
|
830
|
+
result = account.me()
|
|
831
|
+
account.select_organization('team-uuid')
|
|
832
|
+
issued = account.create_api_key({'name': '서버 연동'})
|
|
833
|
+
```
|
|
834
|
+
|
|
835
|
+
지원 메서드: `me`, `organizations`, `select_organization`, `api_keys`, `create_api_key`, `api_key`, `update_api_key`, `delete_api_key`, `issue_token`, `allowed_ips`, `add_allowed_ip`, `delete_allowed_ip`.
|
|
836
|
+
|
|
837
|
+
키 생성 인자는 `name`, 선택적 `ipAddresses: [{ip, description}]`이며, 허용 IP 추가 인자는 `ip`, 선택적 `description`입니다. 키·IP 식별자는 응답의 `id`(UUID)를 사용합니다.
|
|
@@ -781,3 +781,30 @@ MIT License © 2026 [Sendgo](https://sendgo.io)
|
|
|
781
781
|
---
|
|
782
782
|
|
|
783
783
|
*키워드: 카카오 알림톡 Python, 카카오 친구톡 Django, SMS 발송 FastAPI, 알림톡 SDK pip, Python 카카오 API 연동, Django 문자 발송, FastAPI 알림톡, Celery 알림톡 비동기, Sendgo Python SDK*
|
|
784
|
+
|
|
785
|
+
## 계정·조직·API 키 관리 (1.4.0)
|
|
786
|
+
|
|
787
|
+
발송용 `accessKey`/`secretKey`가 없는 단계에서 사용하는 **별도 계정 클라이언트**입니다.
|
|
788
|
+
콘솔에서 발급받은 에이전트 토큰(`SENDGO_AGENT_TOKEN`)으로 `/api/v2/account`를 호출합니다.
|
|
789
|
+
계정 조회에는 `account:read`, 키·허용 IP 변경에는 `keys:write` 권한이 필요합니다.
|
|
790
|
+
토큰 만료나 권한 부족(401/403)은 그대로 예외로 반환하며 자동 갱신·재시도하지 않습니다.
|
|
791
|
+
|
|
792
|
+
조직 선택은 서버에 저장되는 **사용자 계정의 현재 조직**을 바꿉니다. 같은 사용자로
|
|
793
|
+
여러 조직의 설정을 동시에 변경하지 마세요. 개인 계정으로 돌아가려면 조직 ID에
|
|
794
|
+
`null`(Python `None`, Ruby `nil`, Go `nil`) 또는 `personal`을 전달합니다.
|
|
795
|
+
키 발급 응답의 `data.apiKey.secretKey`는 한 번만 반환되므로 서버의 비밀 저장소에 보관하세요.
|
|
796
|
+
허용 IP가 하나라도 등록되면 목록 밖의 IP는 차단됩니다.
|
|
797
|
+
에이전트 토큰과 키는 브라우저·모바일 앱에 포함하거나 응답·로그에 출력하지 않습니다.
|
|
798
|
+
|
|
799
|
+
```python
|
|
800
|
+
import os
|
|
801
|
+
from sendgo import AccountClient
|
|
802
|
+
account = AccountClient(agent_token=os.environ['SENDGO_AGENT_TOKEN'])
|
|
803
|
+
result = account.me()
|
|
804
|
+
account.select_organization('team-uuid')
|
|
805
|
+
issued = account.create_api_key({'name': '서버 연동'})
|
|
806
|
+
```
|
|
807
|
+
|
|
808
|
+
지원 메서드: `me`, `organizations`, `select_organization`, `api_keys`, `create_api_key`, `api_key`, `update_api_key`, `delete_api_key`, `issue_token`, `allowed_ips`, `add_allowed_ip`, `delete_allowed_ip`.
|
|
809
|
+
|
|
810
|
+
키 생성 인자는 `name`, 선택적 `ipAddresses: [{ip, description}]`이며, 허용 IP 추가 인자는 `ip`, 선택적 `description`입니다. 키·IP 식별자는 응답의 `id`(UUID)를 사용합니다.
|
|
@@ -18,6 +18,7 @@ Sendgo Python SDK — 카카오 알림톡/친구톡, SMS/LMS/MMS
|
|
|
18
18
|
)
|
|
19
19
|
"""
|
|
20
20
|
|
|
21
|
+
from .account import AccountClient
|
|
21
22
|
from .brand_message import BrandMessageService
|
|
22
23
|
from .brand_template import BrandTemplateService
|
|
23
24
|
from .kakao_image import (
|
|
@@ -40,6 +41,7 @@ from .client import Sendgo
|
|
|
40
41
|
from .exceptions import SendgoError
|
|
41
42
|
|
|
42
43
|
__all__ = [
|
|
44
|
+
"AccountClient",
|
|
43
45
|
"Sendgo",
|
|
44
46
|
"SendgoError",
|
|
45
47
|
"BrandMessageService",
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from urllib.parse import quote
|
|
4
|
+
import requests
|
|
5
|
+
from .exceptions import SendgoError
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class AccountClient:
|
|
9
|
+
"""서버 전용 계정 API. 에이전트 토큰은 자동 갱신하지 않는다."""
|
|
10
|
+
|
|
11
|
+
def __init__(self, *, agent_token: str, base_url: str = "https://sendgo.io") -> None:
|
|
12
|
+
if not agent_token or not agent_token.strip():
|
|
13
|
+
raise ValueError("Sendgo: agent_token은 필수입니다.")
|
|
14
|
+
self._agent_token = agent_token
|
|
15
|
+
self._base_url = base_url.rstrip("/")
|
|
16
|
+
|
|
17
|
+
def me(self) -> dict:
|
|
18
|
+
"""계정 상태와 다음 단계 조회."""
|
|
19
|
+
return self._request("GET", f"")
|
|
20
|
+
|
|
21
|
+
def organizations(self) -> dict:
|
|
22
|
+
"""조직 목록 조회."""
|
|
23
|
+
return self._request("GET", f"organizations")
|
|
24
|
+
|
|
25
|
+
def select_organization(self, organization_id: str | None) -> dict:
|
|
26
|
+
"""조직 선택. null은 개인 계정."""
|
|
27
|
+
return self._request("POST", f"organizations/select", {'organizationId': organization_id})
|
|
28
|
+
|
|
29
|
+
def api_keys(self) -> dict:
|
|
30
|
+
"""현재 조직의 API 키 목록."""
|
|
31
|
+
return self._request("GET", f"api-keys")
|
|
32
|
+
|
|
33
|
+
def create_api_key(self, params: dict) -> dict:
|
|
34
|
+
"""API 키 발급. secretKey는 이 응답에서만 반환."""
|
|
35
|
+
return self._request("POST", f"api-keys", params)
|
|
36
|
+
|
|
37
|
+
def api_key(self, api_key_id: str) -> dict:
|
|
38
|
+
"""API 키 상세 조회."""
|
|
39
|
+
return self._request("GET", f"api-keys/{quote(api_key_id, safe='')}")
|
|
40
|
+
|
|
41
|
+
def update_api_key(self, api_key_id: str, name: str) -> dict:
|
|
42
|
+
"""API 키 이름 변경."""
|
|
43
|
+
return self._request("PATCH", f"api-keys/{quote(api_key_id, safe='')}", {'name': name})
|
|
44
|
+
|
|
45
|
+
def delete_api_key(self, api_key_id: str) -> dict:
|
|
46
|
+
"""API 키 폐기."""
|
|
47
|
+
return self._request("DELETE", f"api-keys/{quote(api_key_id, safe='')}")
|
|
48
|
+
|
|
49
|
+
def issue_token(self, api_key_id: str) -> dict:
|
|
50
|
+
"""승인된 API 키의 발송용 토큰 발급."""
|
|
51
|
+
return self._request("POST", f"api-keys/{quote(api_key_id, safe='')}/token", {})
|
|
52
|
+
|
|
53
|
+
def allowed_ips(self, api_key_id: str) -> dict:
|
|
54
|
+
"""허용 IP 목록과 호출자 IP 조회."""
|
|
55
|
+
return self._request("GET", f"api-keys/{quote(api_key_id, safe='')}/allowed-ips")
|
|
56
|
+
|
|
57
|
+
def add_allowed_ip(self, api_key_id: str, params: dict) -> dict:
|
|
58
|
+
"""허용 IP 추가. ip와 선택적 description 사용."""
|
|
59
|
+
return self._request("POST", f"api-keys/{quote(api_key_id, safe='')}/allowed-ips", params)
|
|
60
|
+
|
|
61
|
+
def delete_allowed_ip(self, api_key_id: str, ip_id: str) -> dict:
|
|
62
|
+
"""허용 IP 삭제."""
|
|
63
|
+
return self._request("DELETE", f"api-keys/{quote(api_key_id, safe='')}/allowed-ips/{quote(ip_id, safe='')}")
|
|
64
|
+
|
|
65
|
+
def _request(self, method: str, path: str, body: dict | None = None) -> dict:
|
|
66
|
+
response = requests.request(
|
|
67
|
+
method, f"{self._base_url}/api/v2/account" + (f"/{path}" if path else ""),
|
|
68
|
+
headers={"Authorization": f"Bearer {self._agent_token}", "Accept": "application/json"},
|
|
69
|
+
json=body, timeout=15, allow_redirects=False,
|
|
70
|
+
)
|
|
71
|
+
try:
|
|
72
|
+
data = response.json() if response.content else {}
|
|
73
|
+
except ValueError:
|
|
74
|
+
data = {}
|
|
75
|
+
if not 200 <= response.status_code < 300:
|
|
76
|
+
raise SendgoError.from_response(response.status_code, data, path or "account", "v2")
|
|
77
|
+
return data
|
|
@@ -66,9 +66,13 @@ class Sendgo:
|
|
|
66
66
|
|
|
67
67
|
# ------------------------------------------------------ 관리 API (v2)
|
|
68
68
|
# 콘솔에서만 되던 등록·심사. 발송과 달리 대부분 즉시 완료되지 않는다 —
|
|
69
|
-
# 등록 성공은 "접수됨"이지 "사용 가능"이 아니다.
|
|
70
|
-
#
|
|
71
|
-
#
|
|
69
|
+
# 등록 성공은 "접수됨"이지 "사용 가능"이 아니다. 결과는 웹훅으로 받는다.
|
|
70
|
+
#
|
|
71
|
+
# 사람이 개입하는 지점은 카카오 채널 인증번호 하나뿐이고, 그마저도
|
|
72
|
+
# 여러분 화면에서 끝난다 — request_token() 이 채널 관리자 휴대폰으로
|
|
73
|
+
# SMS 를 보내고, 사용자가 입력한 코드를 create() 가 받는다. 휴대폰
|
|
74
|
+
# 발신번호는 PASS 대신 신분증 사본을 첨부해 접수하면 sendgo 가 대신
|
|
75
|
+
# 심사한다.
|
|
72
76
|
self.kakao_senders = KakaoSenderService(http)
|
|
73
77
|
self.notice_templates = NoticeTemplateService(http)
|
|
74
78
|
self.brand_templates = BrandTemplateService(http)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: sendgo-python
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.4.0
|
|
4
4
|
Summary: Sendgo Python SDK — 카카오 알림톡/브랜드메시지, SMS/LMS/MMS
|
|
5
5
|
Author-email: Sendgo <dev@sendgo.io>
|
|
6
6
|
License: MIT
|
|
@@ -808,3 +808,30 @@ MIT License © 2026 [Sendgo](https://sendgo.io)
|
|
|
808
808
|
---
|
|
809
809
|
|
|
810
810
|
*키워드: 카카오 알림톡 Python, 카카오 친구톡 Django, SMS 발송 FastAPI, 알림톡 SDK pip, Python 카카오 API 연동, Django 문자 발송, FastAPI 알림톡, Celery 알림톡 비동기, Sendgo Python SDK*
|
|
811
|
+
|
|
812
|
+
## 계정·조직·API 키 관리 (1.4.0)
|
|
813
|
+
|
|
814
|
+
발송용 `accessKey`/`secretKey`가 없는 단계에서 사용하는 **별도 계정 클라이언트**입니다.
|
|
815
|
+
콘솔에서 발급받은 에이전트 토큰(`SENDGO_AGENT_TOKEN`)으로 `/api/v2/account`를 호출합니다.
|
|
816
|
+
계정 조회에는 `account:read`, 키·허용 IP 변경에는 `keys:write` 권한이 필요합니다.
|
|
817
|
+
토큰 만료나 권한 부족(401/403)은 그대로 예외로 반환하며 자동 갱신·재시도하지 않습니다.
|
|
818
|
+
|
|
819
|
+
조직 선택은 서버에 저장되는 **사용자 계정의 현재 조직**을 바꿉니다. 같은 사용자로
|
|
820
|
+
여러 조직의 설정을 동시에 변경하지 마세요. 개인 계정으로 돌아가려면 조직 ID에
|
|
821
|
+
`null`(Python `None`, Ruby `nil`, Go `nil`) 또는 `personal`을 전달합니다.
|
|
822
|
+
키 발급 응답의 `data.apiKey.secretKey`는 한 번만 반환되므로 서버의 비밀 저장소에 보관하세요.
|
|
823
|
+
허용 IP가 하나라도 등록되면 목록 밖의 IP는 차단됩니다.
|
|
824
|
+
에이전트 토큰과 키는 브라우저·모바일 앱에 포함하거나 응답·로그에 출력하지 않습니다.
|
|
825
|
+
|
|
826
|
+
```python
|
|
827
|
+
import os
|
|
828
|
+
from sendgo import AccountClient
|
|
829
|
+
account = AccountClient(agent_token=os.environ['SENDGO_AGENT_TOKEN'])
|
|
830
|
+
result = account.me()
|
|
831
|
+
account.select_organization('team-uuid')
|
|
832
|
+
issued = account.create_api_key({'name': '서버 연동'})
|
|
833
|
+
```
|
|
834
|
+
|
|
835
|
+
지원 메서드: `me`, `organizations`, `select_organization`, `api_keys`, `create_api_key`, `api_key`, `update_api_key`, `delete_api_key`, `issue_token`, `allowed_ips`, `add_allowed_ip`, `delete_allowed_ip`.
|
|
836
|
+
|
|
837
|
+
키 생성 인자는 `name`, 선택적 `ipAddresses: [{ip, description}]`이며, 허용 IP 추가 인자는 `ip`, 선택적 `description`입니다. 키·IP 식별자는 응답의 `id`(UUID)를 사용합니다.
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|