Skip to content

kuhnemann/plunetapi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Forks Stargazers Issues MIT License LinkedIn

PlunetAPI

Thin wrapper for the Plunet SOAP API.

About The Project

A thin wrapper to facilitate interactions with the PlunetAPI.

(back to top)

Built With

(back to top)

Getting Started

Installation

Clone the repo

git clone https://github.com/kuhnemann/plunetapi.git

Or install via pip

pip install plunetapi

(back to top)

Usage

Install using pip like so:

pip install plunetapi

The wrapper is thin by design and intended to be used by a client. For example something along these lines:

from plunetapi import PlunetAPI
from typing import Union, Callable

class PlunetClient:
    def __init__(self, base_url: str):
        self.plunet = PlunetAPI(base_url=base_url)
        self.uuid = None

    def login(self, username: str, password: str):
        uuid = self.plunet.PlunetAPI.login(username, password)
        if uuid == "refused":
            raise ConnectionRefusedError("Login refused")
        else:
            self.uuid = uuid

    def _make_request(self, operation_proxy: Callable, argument: Union[dict, str, int, list]):
        result = operation_proxy(self.uuid, argument)
        if result.statusCode != 0:
            raise Exception(result.statusMessage)
        else:
            return result.data

    def get_customer_object(self, customer_id: int):
        data_item = self._make_request(self.plunet.DataCustomer30.getCustomerObject, customer_id)
        return data_item

As a complement to the Plunet JavaDocs, use the propagated zeep factory method to explore objects as definied in the different WSDLs. For example:

plunet = PlunetAPI(base_url=base_url)
plunet.DataJob30.factory.PriceLine()
{
    'amount': None,
    'amount_perUnit': None,
    'memo': None,
    'priceLineID': None,
    'priceUnitID': None,
    'sequence': None,
    'taxType': None,
    'time_perUnit': None,
    'unit_price': None
}

(back to top)

See the open issues for a full list of proposed features (and known issues).

(back to top)

Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

(back to top)

License

Distributed under the MIT License. See LICENSE for more information.

(back to top)

Contact

Henrik Kühnemann - @hkuhnemann - hello@yellownape.se

Project Link: https://github.com/kuhnemann/plunetapi

(back to top)

(back to top)

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages