Beispiel #1
0
 def __init__(self,
              apikey=ARROW_API_KEY,
              apilogin=ARROW_API_LOGIN,
              sourcecd='NAC',
              **kwargs):
     if not apikey or not apilogin:
         raise Exception('Arrow needs an API KEY and LOGIN to be '
                         'specified in the tendril config')
     super(VendorArrow, self).__init__(**kwargs)
     self.add_order_additional_cost_component("Customs", 12.85)
     self._manufacturer_codes = None
     self._api_key = apikey
     self._api_login = apilogin
     self._sourcecd = sourcecd
     self._session = www.get_session()
Beispiel #2
0
 def __init__(self, apikey=None, **kwargs):
     self._api_key = apikey
     self._session = www.get_session(target=self._search_url_base)
     super(VendorEPass, self).__init__(**kwargs)
from tendril.config import BASE_CURRENCY_SYMBOL
from tendril.config import BASE_CURRENCY_NAME
from tendril.config import BASE_CURRENCY_LANG
from tendril.config import FIXER_IO_API_KEY

from tendril.utils import www
from decimal import Decimal
from numbers import Number
from num2words import num2words

from .unitbase import NumericalUnitBase
from .unitbase import Percentage

# TODO Switch to a heuristic which uses a cached value only if a fresh
# one is not available.
requests_session = www.get_session(heuristic=ExpiresAfter(days=5))


class CurrencyDefinition(object):
    """
    Instances of this class define a currency.

    The minimal requirement to define a currency is a :attr:`code`, which
    would usually be a standard internationally recognized currency code.

    In addition to the :attr:`code`, a currency definition also includes
    an optional :attr:`symbol`, which is used to create string representations
    of currency values in that currency. In the absence of a :attr:`symbol`,
    the :attr:`code` is used in it's place.

    Unless otherwise specified during the instantiation of the class,
Beispiel #4
0
 def __init__(self, apikey=None, **kwargs):
     self._api_key = apikey
     self._session = www.get_session(target=self._search_url_base)
     super(VendorEPass, self).__init__(**kwargs)
Beispiel #5
0
from tendril.utils.config import BASE_CURRENCY_SYMBOL

from tendril.utils import www

# from six.moves.urllib.request import Request
# from six.moves.urllib.parse import urlencode

import json
import codecs
import numbers

from .unitbase import TypedComparisonMixin

# TODO Switch to a heuristic which uses a cached value only if a fresh
# one is not available.
requests_session = www.get_session(heuristic=ExpiresAfter(days=5))


class CurrencyDefinition(object):
    """
    Instances of this class define a currency.

    The minimal requirement to define a currency is a :attr:`code`, which
    would usually be a standard internationally recognized currency code.

    In addition to the :attr:`code`, a currency definition also includes
    an optional :attr:`symbol`, which is used to create string representations
    of currency values in that currency. In the absence of a :attr:`symbol`,
    the :attr:`code` is used in it's place.

    Unless otherwise specified during the instantiation of the class,