Skip to main content

SDK for "https://subway.simba.taobao.com"

Project description

pysimba

Getting Started

Installing

pip install pysimba

Creating Client

from pysimba import Client

client = Client(app_id=os.getenv('CLIENT_APP_ID'), app_secret=os.getenv('CLIENT_APP_SECRET'), service_url=os.getenv('CLIENT_SERVICE_URL'))

Enable Logging

import logging

logging.basicConfig(level=logging.INFO)

Useful Utils

from pysimba import get, batch, strptime

get

Like dict.get but more deep.

get(r, path='simba_insight_wordsdata_get_response.word_data_list.insight_word_data_d_t_o', default=[])

batch

Batch lets you divide an iterable (currently, last positional argument) of work into pieces.

@batch(100)
def summary(texts):
    r = client.call('taobao.simba.insight.wordsdata.get', params={
        'bidword_list': ','.join(texts),
        'start_date': '2018-10-01',
        'end_date': '2018-10-07'
    })
    return get(r, path='simba_insight_wordsdata_get_response.word_data_list.insight_word_data_d_t_o', default=[])

texts = [f'连衣裙 {x}' for x in range(200)]
results = summary(texts)

strptime

Converting date string to datetime, timezone='Asia/Shanghai'.

strptime('2018-10-16 21:00:50')

Calling

r = client.call('taobao.simba.campaigns.get', token='CUSTOMER_TOKEN_HERE')
results = get(r, path='simba_campaigns_get_response.campaigns.campaign')

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

pysimba-1.1.0.tar.gz (3.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pysimba-1.1.0-py3-none-any.whl (13.2 kB view details)

Uploaded Python 3

File details

Details for the file pysimba-1.1.0.tar.gz.

File metadata

  • Download URL: pysimba-1.1.0.tar.gz
  • Upload date:
  • Size: 3.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.27.0 CPython/3.7.0

File hashes

Hashes for pysimba-1.1.0.tar.gz
Algorithm Hash digest
SHA256 0f16d35e61559513ac1d988f87a741e32893655abcc07bd36082d870d64a5914
MD5 b4822fa58e412473bc2abb8a45de8d6f
BLAKE2b-256 4c45d438de44f9032b17060b1c91154f0d6ae4010e2c2efff4c5bcbd54b200b4

See more details on using hashes here.

File details

Details for the file pysimba-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: pysimba-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 13.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.27.0 CPython/3.7.0

File hashes

Hashes for pysimba-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d714c2e715bd0ed64cca402c16242ea61c9341950d427045fd1592896e3a44af
MD5 5f1a99adb24c46e655859acea6f1bf44
BLAKE2b-256 dcb150436afc9488df09afc6b28c080a5f38b177638d375c2b76ee2e7f37c081

See more details on using hashes here.

Supported by

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