OK App Store Connect API
仅支持 >=Python3.7
Apple官方API文档:https://developer.apple.com/documentation/appstoreconnectapi
同时,也借鉴了 appstoreconnect库 的设计;
安装
pip3 install OKAppleAPI
功能
profile,即mobileprovision文件;
device,即设备(iPhone、iPad等),包括设备的name、UDID信息;
- 获取profile列表;
- 删除一个profile;
- 创建一个profile;
- 获取bundleId列表;
- 获取Certificate证书信息列表;
- 获取device列表;
- 注册一个新device
使用
from okappleapi.apple_api_agent import APIAgent, TokenManager
from okappleapi.models import *
from pathlib import Path
# key参数 支持key文件内容,或者key文件路径(即*.p8文件路径)
token_manager = TokenManager(issuer_id='xxx', key_id='xxx', key='xxx')
# TokenManager.from_json(key_path) # 读取配置文件来创建对象
agent = APIAgent(token_manager)
# 获取certificates列表
cer_list = agent.list_certificates()
for tmp_cer in cer_list:
print(f'{tmp_cer.id}, {tmp_cer.attributes.__dict__}')
# 获取bundle_id列表
bundle_id_list = agent.list_bundle_id()
for tmp_id in bundle_id_list:
print(f'{tmp_id.id}, {tmp_id.attributes}')
# 获取device设备列表
device_list = agent.list_devices()
for tmp_device in device_list:
print(tmp_device.__dict__)
# 获取profile列表
profile_list = agent.list_profiles()
for index, tmp_profile in enumerate(profile_list, start=1):
print(f"profile: {index}. {tmp_profile.id}, {tmp_profile.attributes.name}")
# 创建profile
attrs = ProfileCreateReqAttrs('test_hello')
result = agent.create_a_profile(attrs, bundle_id=bundle_id_list[0], devices=device_list, certificates=cer_list)
print(f'create profile: {result.id}, {result.attributes.name}')
# 删除刚创建的profile
agent.delete_a_profile(result.id)
# 添加一个iOS新设备
device_name = 'xxx'
device_udid = 'xxx'
result = agent.register_a_device(DeviceCreateReqAttrs(device_name, device_udid))
print(result)
# 更新一个profile
from okappleapi.ok_agent import OKProfileManager
profile_name = 'test_hello'
bundle_id_str = 'com.oksw.hellotest'
ok_agent = OKProfileManager.from_token_manager(token_manager)
ok_agent.update_profile(profile_name, bundle_id_str=bundle_id_str)
待完成
- 处理所有时间的时区问题;
Metadata
Release files for OKAppleAPI 1.5.2
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 | Actions |
|---|---|---|---|---|
| OKAppleAPI-1.5.2.tar.gz | 14.1 kB | Without provenance | Details for OKAppleAPI-1.5.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| OKAppleAPI-1.5.2-py3-none-any.whl | Python 3 | none | any | Details for OKAppleAPI-1.5.2-py3-none-any.whl |
Total release size: 29.6 kB
Release files / OKAppleAPI-1.5.2.tar.gz
| Download URL | OKAppleAPI-1.5.2.tar.gz |
|---|---|
| Size | 14.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5a232b11e67a61740c5ccca91608849185cdf9590218f71175c8c7bed5d25327
|
|
BLAKE2b-256 checksum How to use checksums |
5cd7df1565802f91258e5a255b0b4adbc8c97e1f4a785e4dadc86ddbe41f69b8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.9.6
|
Release files / OKAppleAPI-1.5.2-py3-none-any.whl
| Download URL | OKAppleAPI-1.5.2-py3-none-any.whl |
|---|---|
| Size | 15.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4512356375e002f7f5036cc1d55c2ff5539a7f1ba961698f3f87ce3894b5a9fc
|
|
BLAKE2b-256 checksum How to use checksums |
29f7cda04c02ad054737aea00b90e1e778e17873e5686fccb912e762d3dd37e6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.9.6
|
Security for OKAppleAPI 1.5.2
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.
To learn more about protecting yourself from malicious actors, visit our package security documentation.