IAMPORT async python rest client
from https://github.com/iamport/iamport-rest-client-python
개선 사항
- sync -> async
- Token 재사용
- 만료 60s 이상 남았을 경우 재사용
- 그 이하일 경우 재인증
- .format() -> f-string
- typing 적용, mypy 적용
변경 사항
- python2 지원 안함
- requests -> aiohttp
- 기존 retry(3회) 옵션 제거
작업 예정
- 필수 필드 검증을 아에 제거하고 iamport api 의 응답만 확인하도록 해서 필드 변경에 대한 유연성 및 코드의 책임 범위를 낮추기
- 기존 method 호환을 위해 유지
- 추가 API는 path parameter 만 positional args 으로 처리, 나머지는 kwargs로 payload 담음
함수들의 이름을 iamport api들의 호출 이름과 유사하게 전부 정리하기- 기존 client api 유지
- 미구현 API 추가 예정
- param validation 제거
- type annotation 추가
- docstring 추가
주의 사항
- 사용 중 발생한 문제의 책임은 사용자에게 있습니다.
- iamport 정식 api로 동작 완전성 테스트 되지 않았습니다. url 이상 여부만 검증 되었습니다.
Deps
-
python >= 3.7
-
Aiohttp >= 3.8.3
-
arrow >= 1.2.3
Install
pip install async-iamport
FastAPI Example
from fastapi import FastAPI
from async_iamport import AsyncIamport
DEFAULT_TEST_IMP_KEY = "imp_apikey"
DEFAULT_TEST_IMP_SECRET = (
"ekKoeW8RyKuT0zgaZsUtXXTLQ4AhPFW3ZGseDA6b"
"kA5lamv9OqDMnxyeB9wqOsuO9W3Mx9YSJ4dTqJ3f"
)
async_iamport = AsyncIamport(
imp_key=DEFAULT_TEST_IMP_KEY, imp_secret=DEFAULT_TEST_IMP_SECRET
)
app = FastAPI(on_shutdown=[async_iamport.close_session])
mocked_response = {
"status": "paid",
"amount": 1000,
}
@app.get("/")
async def root():
return await async_iamport.find_by_merchant_uid(merchant_uid="1234qwer")
uvicorn main:app --reload
Metadata
Release files for async-iamport 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| async_iamport-0.2.0.tar.gz | 6.1 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| async_iamport-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 12.2 kB
Release files / async_iamport-0.2.0.tar.gz
| Download URL | async_iamport-0.2.0.tar.gz |
|---|---|
| Size | 6.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
56e90cf8d71d8805c14443fd15ef8eb867fd64ea45d4738c57892f73b9b6ec94
|
|
BLAKE2b-256 checksum How to use checksums |
4ac7e49265401eb9f29ad8787ba98364efb390b5e210b70ab22800d42867d1b7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.3.2 CPython/3.7.15 Linux/5.15.0-1031-azure
|
Release files / async_iamport-0.2.0-py3-none-any.whl
| Download URL | async_iamport-0.2.0-py3-none-any.whl |
|---|---|
| Size | 6.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6ad574680f10358010497cf658afc02f5e857183ffb2b9518c2aebf5eda0c264
|
|
BLAKE2b-256 checksum How to use checksums |
298471c7fe571f287d30aabd2726974e6c7cd88c428f774ce1ab5f500ad75b3d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.3.2 CPython/3.7.15 Linux/5.15.0-1031-azure
|
Security for async-iamport 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.