Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get shipping service name by its code #2

Open
eriktelepovsky opened this issue Nov 12, 2013 · 2 comments
Open

Get shipping service name by its code #2

eriktelepovsky opened this issue Nov 12, 2013 · 2 comments

Comments

@eriktelepovsky
Copy link

It would be great if I could get service name by its code with something like this:

def get_service_name(service_code):
    """
    Given a service code, return the human-readable name for 
    that service

    @return: string on success or False
    """
    return SHIPPING_SERVICES_NAMES.get(service_code, service_code)
@poundifdef
Copy link
Owner

I don't immediately object to this. What is the use case? For example, when requesting tracking information, the return XML from UPS gives a human-readable description of the shipping type in TrackResponse.Shipment.Service.Description. Would it be sufficient to expose that? Or is the goal to get a list of all supported types? In that case, would it just return the existing SHIPPING_SERVICES dict?

@eriktelepovsky
Copy link
Author

Well, the existing dict

SHIPPING_SERVICES = {
        '1dayair': '01',  # Next Day Air
        '2dayair': '02',  # 2nd Day Air
        'ground': '03',  # Ground
        'express': '07',  # Express
        'worldwide_expedited': '08',  # Expedited
        'standard': '11',  # UPS Standard
        '3_day_select': '12',  # 3 Day Select
        'next_day_air_saver': '13',  # Next Day Air Saver
        'next_day_air_early_am': '14',  # Next Day Air Early AM
        'express_plus': '54',  # Express Plus
        '2nd_day_air_am': '59',  # 2nd Day Air A.M.
        'ups_saver': '65',  # UPS Saver.
        'ups_today_standard': '82',  # UPS Today Standard
        'ups_today_dedicated_courier': '83',  # UPS Today Dedicated Courier
        'ups_today_intercity': '84',  # UPS Today Intercity
        'ups_today_express': '85',  # UPS Today Express
        'ups_today_express_saver': '86',  # UPS Today Express Saver.
    }

returns only ID of each service. I would like to get its name. For example: get_service_name('1dayair') or get_service_name('01') would return 'Next Day Air'. I am also trying to get rates for a giving package information for all available shipping services without confirming the created shipping. Is it possible?

zamberjo referenced this issue in aurestic/ClassicUPS Nov 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants