Giter Site home page Giter Site logo

stamps's People

Contributors

gusnaughton avatar jzempel avatar thenewguy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

stamps's Issues

Floats are being used for money

It appears that postage amounts are represented with floats instead of decimals.

This might be a suds problem, but I figured it was important to at least mention this. Float results in rounding errors and should not be used for money.

Here is an example I just encountered -- Amount is 5.42, but it is shown as 5.4199999999999999 under the hood.

I discovered this because the decimal class raised a TypeError when it was fed the float.

If it is possible to use the decimal class, that would be prudent.

Accept kwargs on convenience methods

It would be nice to be to pass through kwargs supplied to the convenience methods. It is probably too much work to keep all of the kwargs up to date, but if kwargs are passed through as is then it doesn't require creating a subclass of the service to allow get_label to specify the image type or other less commonly used options.

Or something like this could be used to convert stamps camelcase to underscore notation with a map function for the option keys

import re

first_cap_re = re.compile('(.)([A-Z][a-z]+)')
all_cap_re = re.compile('([a-z0-9])([A-Z])')

def pythonify_stamps_key(key):
    """
        THIS FUNCTION CONVERTS STAMPS.COM API CAMEL CASED
        FIELD NAMES INTO PYTHONIC UNDERSCORED FIELD NAMES
    """
    s1 = first_cap_re.sub(r'\1_\2', key)
    return all_cap_re.sub(r'\1_\2', s1).lower()

Doc improvement

A minor example that logs in, gets account info and creates a shipping label would be helpful.

Hidden postage and memo in the label call

Hello Jonathan,

I am trying to figure out how to get these work and hopefully you can shed some light on these.

  • Hidden Postage
    I appended the addon but the postage still appeared on the label
    ....
    addOn = service.create_add_on()
    addOn.AddOnType = 'SC-A-HP'
    ret_val.AddOns.AddOnV7.append(addOn)
    ....
  • memo:
    I added memo in the call to see if it would work, but it didn't appear on the label

def get_label(self, from_address, to_address, rate, transaction_id, sample=False):
return self.call("CreateIndicium", IntegratorTxID=transaction_id,
Rate=rate, From=from_address, To=to_address, SampleOnly=sample, memo='test order')

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.