OKAppleAPI


NameOKAppleAPI JSON
Version 1.5.0 PyPI version JSON
download
home_pagehttps://github.com/shede333/OKAppleAPI
SummaryOK App Store Connect API
upload_time2024-03-06 17:02:26
maintainer
docs_urlNone
authorshede333
requires_python~=3.7
license
keywords ios ok apple appstore app store connect api appstoreconnectapi
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # OK App Store Connect API

仅支持 >=Python3.7

Apple官方API文档:<https://developer.apple.com/documentation/appstoreconnectapi>

同时,也借鉴了 [appstoreconnect库](https://pypi.org/project/appstoreconnect/) 的设计;

## 安装

```shell
pip3 install OKAppleAPI
```

## 功能

profile,即mobileprovision文件;  
device,即设备(iPhone、iPad等),包括设备的name、UDID信息;

* 获取profile列表;
* 删除一个profile;
* 创建一个profile;
* 获取bundleId列表;
* 获取Certificate证书信息列表;
* 获取device列表;
* 注册一个新device

## 使用

```python

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)


```

## 待完成

1. 处理所有时间的时区问题;


            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/shede333/OKAppleAPI",
    "name": "OKAppleAPI",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "~=3.7",
    "maintainer_email": "",
    "keywords": "ios ok apple appstore app store connect api appstoreconnectapi",
    "author": "shede333",
    "author_email": "333wshw@163.com",
    "download_url": "https://files.pythonhosted.org/packages/2f/e7/71d9c2617245b209e89885370e1593718887a7b49887e8cf557fbf874c94/OKAppleAPI-1.5.0.tar.gz",
    "platform": null,
    "description": "# OK App Store Connect API\n\n\u4ec5\u652f\u6301 >=Python3.7\n\nApple\u5b98\u65b9API\u6587\u6863\uff1a<https://developer.apple.com/documentation/appstoreconnectapi>\n\n\u540c\u65f6\uff0c\u4e5f\u501f\u9274\u4e86 [appstoreconnect\u5e93](https://pypi.org/project/appstoreconnect/) \u7684\u8bbe\u8ba1\uff1b\n\n## \u5b89\u88c5\n\n```shell\npip3 install OKAppleAPI\n```\n\n## \u529f\u80fd\n\nprofile\uff0c\u5373mobileprovision\u6587\u4ef6\uff1b  \ndevice\uff0c\u5373\u8bbe\u5907\uff08iPhone\u3001iPad\u7b49\uff09\uff0c\u5305\u62ec\u8bbe\u5907\u7684name\u3001UDID\u4fe1\u606f\uff1b\n\n* \u83b7\u53d6profile\u5217\u8868\uff1b\n* \u5220\u9664\u4e00\u4e2aprofile\uff1b\n* \u521b\u5efa\u4e00\u4e2aprofile\uff1b\n* \u83b7\u53d6bundleId\u5217\u8868\uff1b\n* \u83b7\u53d6Certificate\u8bc1\u4e66\u4fe1\u606f\u5217\u8868\uff1b\n* \u83b7\u53d6device\u5217\u8868\uff1b\n* \u6ce8\u518c\u4e00\u4e2a\u65b0device\n\n## \u4f7f\u7528\n\n```python\n\nfrom okappleapi.apple_api_agent import APIAgent, TokenManager\nfrom okappleapi.models import *\nfrom pathlib import Path\n\n# key\u53c2\u6570 \u652f\u6301key\u6587\u4ef6\u5185\u5bb9\uff0c\u6216\u8005key\u6587\u4ef6\u8def\u5f84\uff08\u5373*.p8\u6587\u4ef6\u8def\u5f84\uff09\ntoken_manager = TokenManager(issuer_id='xxx', key_id='xxx', key='xxx')\n# TokenManager.from_json(key_path)  # \u8bfb\u53d6\u914d\u7f6e\u6587\u4ef6\u6765\u521b\u5efa\u5bf9\u8c61\n\nagent = APIAgent(token_manager)\n\n# \u83b7\u53d6certificates\u5217\u8868\ncer_list = agent.list_certificates()\nfor tmp_cer in cer_list:\n    print(f'{tmp_cer.id}, {tmp_cer.attributes.__dict__}')\n\n# \u83b7\u53d6bundle_id\u5217\u8868\nbundle_id_list = agent.list_bundle_id()\nfor tmp_id in bundle_id_list:\n    print(f'{tmp_id.id}, {tmp_id.attributes}')\n\n# \u83b7\u53d6device\u8bbe\u5907\u5217\u8868\ndevice_list = agent.list_devices()\nfor tmp_device in device_list:\n    print(tmp_device.__dict__)\n\n# \u83b7\u53d6profile\u5217\u8868\nprofile_list = agent.list_profiles()\nfor index, tmp_profile in enumerate(profile_list, start=1):\n    print(f\"profile: {index}. {tmp_profile.id}, {tmp_profile.attributes.name}\")\n\n# \u521b\u5efaprofile\nattrs = ProfileCreateReqAttrs('test_hello')\nresult = agent.create_a_profile(attrs, bundle_id=bundle_id_list[0], devices=device_list, certificates=cer_list)\nprint(f'create profile: {result.id}, {result.attributes.name}')\n\n# \u5220\u9664\u521a\u521b\u5efa\u7684profile\nagent.delete_a_profile(result.id)\n\n# \u6dfb\u52a0\u4e00\u4e2aiOS\u65b0\u8bbe\u5907\ndevice_name = 'xxx'\ndevice_udid = 'xxx'\nresult = agent.register_a_device(DeviceCreateReqAttrs(device_name, device_udid))\nprint(result)\n\n\n# \u66f4\u65b0\u4e00\u4e2aprofile\nfrom okappleapi.ok_agent import OKProfileManager\n\nprofile_name = 'test_hello'\nbundle_id_str = 'com.oksw.hellotest'\nok_agent = OKProfileManager.from_token_manager(token_manager)\nok_agent.update_profile(profile_name, bundle_id_str=bundle_id_str)\n\n\n```\n\n## \u5f85\u5b8c\u6210\n\n1. \u5904\u7406\u6240\u6709\u65f6\u95f4\u7684\u65f6\u533a\u95ee\u9898\uff1b\n\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "OK App Store Connect API",
    "version": "1.5.0",
    "project_urls": {
        "Homepage": "https://github.com/shede333/OKAppleAPI"
    },
    "split_keywords": [
        "ios",
        "ok",
        "apple",
        "appstore",
        "app",
        "store",
        "connect",
        "api",
        "appstoreconnectapi"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "2c300dc04cdf87e88273c2cfa48b01675672e1cb9ae6276557097b5eba36fe00",
                "md5": "7900c57ae97266db0c2b838897eff865",
                "sha256": "50575b0f651da128403a139bf33229f36191e324554bac13786e59e51da6201a"
            },
            "downloads": -1,
            "filename": "OKAppleAPI-1.5.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "7900c57ae97266db0c2b838897eff865",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "~=3.7",
            "size": 15351,
            "upload_time": "2024-03-06T17:02:25",
            "upload_time_iso_8601": "2024-03-06T17:02:25.637117Z",
            "url": "https://files.pythonhosted.org/packages/2c/30/0dc04cdf87e88273c2cfa48b01675672e1cb9ae6276557097b5eba36fe00/OKAppleAPI-1.5.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "2fe771d9c2617245b209e89885370e1593718887a7b49887e8cf557fbf874c94",
                "md5": "53ade87eb01b858cca256467c41b4a2a",
                "sha256": "83ef3be166cc509f13ece041f7ea72f0eaa911c2e1303872dca65dab4a032fa2"
            },
            "downloads": -1,
            "filename": "OKAppleAPI-1.5.0.tar.gz",
            "has_sig": false,
            "md5_digest": "53ade87eb01b858cca256467c41b4a2a",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "~=3.7",
            "size": 14009,
            "upload_time": "2024-03-06T17:02:26",
            "upload_time_iso_8601": "2024-03-06T17:02:26.973771Z",
            "url": "https://files.pythonhosted.org/packages/2f/e7/71d9c2617245b209e89885370e1593718887a7b49887e8cf557fbf874c94/OKAppleAPI-1.5.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-03-06 17:02:26",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "shede333",
    "github_project": "OKAppleAPI",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "okappleapi"
}
        
Elapsed time: 0.19930s