Skip to main content

The official LongMao SDK for Python.

Project description

longmao-open-sdk-python

The official LongMao SDK for Python.

访问龙猫数据开放平台的官方SDK。

Links

Example

.. code-block:: python

#!/usr/bin/env python
# -*- coding: utf-8 -*-
import logging
import traceback

from longmao.api.project.ApiProjectTaskCreate import ApiProjectTaskCreate
from longmao.core.DefaultLongMaoClient import DefaultLongMaoClient
from longmao.core.LongMaoClientConfig import LongMaoClientConfig

logging.basicConfig(
    level=logging.INFO,
    format='%(asctime)s %(levelname)s %(message)s',
    filemode='a',)
logger = logging.getLogger('')


if __name__ == '__main__':
    """
    设置配置。
    """
    longmao_client_config = LongMaoClientConfig()
    longmao_client_config.access_key_id = '58bf489978ed44c49a4b9c64e96d9d6f'
    longmao_client_config.access_key_secret = 'bacb00c2e0200ccd7e997b53c9efb62d795b70e9'

    """
    得到客户端对象。
    """
    client = DefaultLongMaoClient(longmao_client_config, logger)

    """
    系统接口示例:批量添加任务
    """
    # 对照接口文档,构造请求对象
    api = ApiProjectTaskCreate()
    api.project_id = 'd36ec84f-ea18-4d1d-ae33-33bbad816f11'
    api.file = {'file': open('/longmao/data/demo.csv', 'rb')}

    result = None
    try:
        result = client.execute(api)
    except Exception as e:
        print(traceback.format_exc())
    if not result:
        print("failed execute")
    else:
        if result['code'] == '200':
            # 成功
            print("get response job_id:" + result['object']['job_id'])
        else:
            # 失败
            print(result['code'] + "," + result['message'])

Project details


Download files

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

Files for longmao-open-sdk-python, version 0.1.1
Filename, size File type Python version Upload date Hashes
Filename, size longmao_open_sdk_python-0.1.1-py3-none-any.whl (21.5 kB) File type Wheel Python version py3 Upload date Hashes View hashes
Filename, size longmao-open-sdk-python-0.1.1.tar.gz (9.4 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page