Giter VIP home page Giter VIP logo

royal_mail_rest_api's Introduction

Royal Mail Rest API

Documentation Status

A small helper for integrating python with Royal Mails Rest API

This is to help with getting started integrating Royal Mails shipping and Tracking API's into your project.

They do have an Open API to build this with Swagger-Codegen, but I found there were a few issues with this. 1. Horrible final code - overly verbose and complicated. 1. Half the time it would not build (needed beta versions of swagger-codegen) and then it would still not work.

This is cleaner, easier to modify and extend, and a lot lighter weight, only using the standard library.

It is VERY MUCH a work in progress, so help is hugely appreciated, and be careful, it may change as I implement more features / improve and enhance what we already have.

Features

Create Labels Update Labels Create Manifests Post Manifests

Credits

This package was created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.

royal_mail_rest_api's People

Contributors

bobspadger avatar dependabot[bot] avatar

Watchers

 avatar  avatar

Forkers

hardikg

royal_mail_rest_api's Issues

AttributeError: 'RoyalMailBody' object has no attribute 'add_service'

  • Royal Mail Rest API version: royal-mail-rest-api-0.0.9
  • Python version: Python 3.6.8
  • Operating System: Ubuntu 18.04

Description

I just tried the demo code given at https://royal-mail-rest-api.readthedocs.io/en/latest/usage.html
when it executes body.add_service('P', 1, 'TPN', 'T', True, ['14'])
It gives an error that there is no add_service method in RoyalMailBody.

After checking into the gitlab it was not there.

AttributeError: 'RoyalMailBody' object has no attribute 'add_service'

JWT Token as a 4 hour lifetime

The returned Auth token for shipping has a 4 hour lifetime according to royal mail docs.

Allow the API to:

  • not re-authenticate if the token is still valid
  • re-authenticate automatically if the token has expired

Error Codes

Instead of using requests.raise_for_status() maybe inspect the error code, and return the friendly error along with an exception to enable better and easier access

Decorator for token refresh

Tokens expire after 4 hours, add a decorator than can be added to each method to check the validity / expiry time of any token we may have.

If expired, refresh.

Service offering

Make sure the service offering is validated before any api call happens

Enhancements

Only 1 enhancement from each of the groups must be selected.

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.