Skip to main content

No project description provided

Project description

IAMPORT async python rest client

from https://github.com/iamport/iamport-rest-client-python

개선 사항

  1. sync -> async
  2. Token 재사용
    • 만료 60s 이상 남았을 경우 재사용
    • 그 이하일 경우 재인증
  3. .format() -> f-string
  4. typing 적용, mypy 적용

변경 사항

  1. python2 지원 안함
  2. requests -> aiohttp
  3. 기존 retry(3회) 옵션 제거

작업 예정

  1. 필수 필드 검증을 아에 제거하고 iamport api 의 응답만 확인하도록 해서 필드 변경에 대한 유연성 및 코드의 책임 범위를 낮추기
    • 기존 method 호환을 위해 유지
    • 추가 API는 path parameter 만 positional args 으로 처리, 나머지는 kwargs로 payload 담음
  2. 함수들의 이름을 iamport api들의 호출 이름과 유사하게 전부 정리하기
    • 기존 client api 유지
  3. 미구현 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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

async_iamport-0.2.0.tar.gz (6.1 kB view details)

Uploaded Source

Built Distribution

async_iamport-0.2.0-py3-none-any.whl (6.1 kB view details)

Uploaded Python 3

File details

Details for the file async_iamport-0.2.0.tar.gz.

File metadata

  • Download URL: async_iamport-0.2.0.tar.gz
  • Upload date:
  • Size: 6.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.3.2 CPython/3.7.15 Linux/5.15.0-1031-azure

File hashes

Hashes for async_iamport-0.2.0.tar.gz
Algorithm Hash digest
SHA256 56e90cf8d71d8805c14443fd15ef8eb867fd64ea45d4738c57892f73b9b6ec94
MD5 f0c3a1236b2d995d84b1401491974818
BLAKE2b-256 4ac7e49265401eb9f29ad8787ba98364efb390b5e210b70ab22800d42867d1b7

See more details on using hashes here.

File details

Details for the file async_iamport-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: async_iamport-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 6.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.3.2 CPython/3.7.15 Linux/5.15.0-1031-azure

File hashes

Hashes for async_iamport-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6ad574680f10358010497cf658afc02f5e857183ffb2b9518c2aebf5eda0c264
MD5 b796f8c2529b96a3763b2b84a6f84239
BLAKE2b-256 298471c7fe571f287d30aabd2726974e6c7cd88c428f774ce1ab5f500ad75b3d

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page