Beispiel #1
0
def test_no_rms_keys():
    ws = RakutenWebService()
    with assert_raises(Exception, "A 'license_key' and 'secret_service' must be provided"):
        ws.rms.order.getRequestId()
    ws = RakutenWebService(license_key="TOOTO")
    with assert_raises(Exception, "A 'license_key' and 'secret_service' must be provided"):
        ws.rms.order.getRequestId()
    ws = RakutenWebService(secret_service="TOOTO")
    with assert_raises(Exception, "A 'license_key' and 'secret_service' must be provided"):
        ws.rms.order.getRequestId()
Beispiel #2
0
    def getRmsService(self, conf):
        credentials = {
            'license_key': conf['licenseKey'],
            'secret_service': conf['secretService'],
            'shop_url': conf['shopUrl'],
        }
        ws = RakutenWebService(**credentials)
        ua = 'OrderListClient/1.0.1'
        if conf['RPay'] == '0':
            ws.rms.order.zeep_client.transport.session.headers[
                'User-Agent'] = ua
        else:
            ws.rms.rpay.search_order.client.service.webservice.session.headers[
                'User-Agent'] = ua
            ws.rms.rpay.get_order.client.service.webservice.session.headers[
                'User-Agent'] = ua

        return ws
Beispiel #3
0
def test_fake_credentials(fake_credentials):
    ws = RakutenWebService(**fake_credentials)
    result = ws.ichiba.item.search(item_code="book:17924463")
    assert result['error_description'] == 'specify valid applicationId'
    assert result['error'] == 'wrong_parameter'
Beispiel #4
0
def test_credentials(credentials):
    ws = RakutenWebService(**credentials)
    item = ws.ichiba.item.search(item_code="book:17924463")['Items'][0]
    assert item['itemName'] == 'NARUTO THE BEST (期間生産限定盤) [ (アニメーション) ]'  # noqa
Beispiel #5
0
def test_no_application():
    ws = RakutenWebService()
    with assert_raises(Exception, "An 'application_id' must be provided"):
        ws.ichiba.item.search(item_code="book:17924463")
Beispiel #6
0
#!/usr/bin/env python
# coding: utf-8
import os

from rakuten_ws import RakutenWebService

credentials = {
    'application_id': os.environ.get('RAKUTEN_APP_ID', ''),
    'license_key': os.environ.get('RMS_LICENSE_KEY', ''),
    'secret_service': os.environ.get('RMS_SECRET_SERVICE', ''),
    'shop_url': os.environ.get('RMS_SHOP_URL', ''),
}

assert len(credentials['shop_url']) > 0

ws = RakutenWebService(**credentials)
Beispiel #7
0
def ws(credentials, request):
    ws_debug = request.config.getoption("--ws-debug")
    return RakutenWebService(debug=ws_debug, **credentials)