Git Product home page Git Product logo

fs-moysklad-api's Introduction

MoySklad

PyPI Version

Описание

Библиотека упрощающая работу с API МойСклад.

Возможности

  • Конструктор фильтров и запросов
  • Репозиторй API эндпоинтов
  • Возможность работы с JSON и POS API

Конструктор запросов

Фильтрация

Filter().exists('email').eq('archived', False).exists('name', False)

Комбинирование фильтров

new_filter = Filter().exists('email') + Filter().exists('name', False)

Документация по фильтрам

Сортировка

Ordering().asc('id').desc('name')

Документация сортировки

Контекстный поиск

Search('петров')

Документация контекстного поиска

Раскрытие вложенных сущностей

Expand('owner', 'owner.group', 'state')

Документация

Параметры фильтрации выборки

Select(limit=1, offset=0, updated_to=datetime.now(), updated_by='uuid')

Документация

Примеры кода

Авторизация и получения контрагентов с применением фильтрации

from moysklad.api import MoySklad
from moysklad.queries import Expand, Filter, Ordering, Select, Search, Query


sklad = MoySklad.get_instance('login', 'password')
client = sklad.get_client()
methods = sklad.get_methods()

response = client.get(
    method=methods.get_list_url('counterparty'),
    query=Query(
        Filter().exists('email').eq('archived', False),
        Search('петров'),
        Expand('owner', 'owner.group'),
        Ordering().asc('id').desc('name'),
        Select(limit=1),
    ),
)
print(response.meta)
print(response.context)
print(response.rows[0])

Использование прокси

sklad = MoySklad.get_instance('login', 'password')
client = sklad.get_client()

proxies = {
    'http': 'type://user:pass@host:port',
    'https:': 'type://user:pass@host:port',
}
client.set_proxies(proxies)

Для использования SOCKS5 прокси необходимо установить библиотеку PySocks.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.