A client library for the REST API of DocuWare's DMS

Overview

docuware-client

This is a client library for the REST API of DocuWare DMS. Since DocuWare's documentation regarding the REST API is very sparse (at the time these lines were written), this client serves only a part of the API's functionality.

Please keep in mind: This software is not related to DocuWare. It is a work in progress, may yield unexpected results, and almost certainly contains bugs.

Usage

First you have to log in and create a persistent session:

import json
import pathlib
import docuware

dw = docuware.Client("http://localhost")
session = dw.login("username", "password", "organization")
with open(".session", "w") as f:
    json.dump(session, f)

From then on you have to reuse the session, otherwise you will be locked out of the DocuWare server for a period of time (10 minutes or longer). As the session cookie may change on subsequent logins, update the session file on every login.

session_file = pathlib.Path(".session")
if session_file.exists():
    with open(session_file) as f:
        session = json.load(f)
else:
    session = None
dw = docuware.Client("http://localhost")
session = dw.login("username", "password", "organization", cookiejar=session)
with open(session_file, "w") as f:
    json.dump(session, f)

Iterate over the organizations and file cabinets:

for org in dw.organizations:
    print(org)
    for fc in org.file_cabinets:
        print("   ", fc)

If you already know the ID or name of the objects, you can also access them directly.

org = dw.organization("1")
fc = org.file_cabinet("Archive")

Now some examples of how to search for documents. First you need a search dialog:

# Let's use the first one:
dlg = fc.search_dialog()
# Or a specific search dialog:
dlg = fc.search_dialog("Default search dialog")

Each search term consists of a field name and a search pattern. Each search dialog knows its fields:

for field in dlg.fields.values():
    print(field)

Let's search for some documents:

# Search for DOCNO equal to '123456':
for result in dlg.search("DOCNO=123456"):
    print(result)
# Search for two patterns alternatively:
for result in dlg.search(["DOCNO=123456", "DOCNO=654321"], operation=docuware.OR):
    print(result)

Please note that search terms may also contain metacharacters such as *, (, ), which may need to be escaped when searching for these characters themselves.

for result in dlg.search("DOCTYPE=Invoice \\(incoming\\)"):
    print(result)

Search terms can be as simple as a single string, but can also be more complex. The following two queries are equivalent:

dlg.search(["FIELD1=TERM1,TERM2", "FIELD2=TERM3"])
dlg.search({"FIELD1": ["TERM1", "TERM2"], "FIELD2": ["TERM3"]})

The result of a search is always an iterator over the search results, even if no result was obtained. Each individual search result holds a document attribute, which gives access to the document in the archive. The document itself can be downloaded as a whole or only individual attachments.

for result in dlg.search("DOCNO=123456"):
    doc = result.document
    # Download the complete document ...
    data, content_type, filename = doc.download(keep_annotations=True)
    docuware.write_binary_file(data, filename)
    # ... or individual attachments (or sections, as DocuWare calls them)
    for att in doc.attachments:
        data, content_type, filename = att.download()
        docuware.write_binary_file(data, filename)

CLI usage

This package also includes a simple CLI program for collecting information about the archive and searching and downloading documents or attachments.

First you need to log in:

$ dw-client login --url http://localhost/ --username "Doe, John" --password FooBar --organization "Doe Inc."

The credentials and the session cookie are stored in the .credentials and .session files in the current directory.

Of course, --help will give you a list of all options:

$ dw-client --help

Some search examples (Bash shell syntax):

$ dw-client search --file-cabinet Archive Customer=Foo\*
$ dw-client search --file-cabinet Archive DocNo=123456 "DocType=Invoice \\(incoming\\)"
$ dw-client search --file-cabinet Archive DocDate=2022-02-14

Downloading documents:

$ dw-client search --file-cabinet Archive Customer=Foo\* --download document --annotations

Downloading attachments (or sections):

$ dw-client search --file-cabinet Archive DocNo=123456 --download attachments

Some information about your DocuWare installation:

$ dw-client info

Listing all organizations, file cabinets and dialogs at once:

$ dw-client list

A more specific list, only one file cabinet:

$ dw-client list --file-cabinet Archive

You can also display a (partial) selection of the contents of individual fields:

$ dw-client list --file-cabinet Archive --dialog custom --field DocNo

Further reading

License

This work is released under the BSD 3 license. You may use and redistribute this software as long as the copyright notice is preserved.

Owner
Stefan Schönberger
Stefan Schönberger
:cloud: Python API for ThePirateBay.

Unofficial Python API for ThePirateBay. Build Status Test Coverage Version Downloads (30 days) Installation $ pip install ThePirateBay Note that ThePi

Karan Goel 334 Oct 21, 2022
Deepak Clouds Torrent is a multipurpose Telegram Bot writen in Python for mirroring files on the Internet to our beloved Google Drive.

Deepak Clouds Torrent is a multipurpose Telegram Bot writen in Python for mirroring files on the Internet to our beloved Google Drive.

Deepak Clouds 37 Oct 28, 2022
Aqui está disponível GRATUITAMENTE, um bot de discord feito em python, saiba que, terá que criar seu bot como aplicação, e utilizar seu próprio token, e lembrando, é um bot básico, não se utiliza Cogs nem slash commands nele!

BotDiscordPython Aqui está disponível GRATUITAMENTE, um bot de discord feito em python, saiba que, terá que criar seu bot como aplicação, e utilizar s

Matheus Muguet 4 Feb 05, 2022
A file-based quote bot written in Python

Let's Write a Python Quote Bot! This repository will get you started with building a quote bot in Python. It's meant to be used along with the Learnin

A . S . M . RADWAN 2 Apr 03, 2022
SaltConf21: Adding Workflow Approval to Salt

SaltConf21: Adding Workflow Approval to Salt Running To run the example, install Docker and docker-compose and run the following commands: docker-comp

SSYS Sistemas 4 Nov 24, 2021
A simple google translator telegram bot version 2

Translator-Bot-V2 A simple google translator telegram bot version 2 Made with Python3 (C) @FayasNoushad Copyright permission under MIT License License

Fayas Noushad 15 Oct 21, 2022
A new coin listing alert bot using Python, Flask, MongoDB, Telegram API and Binance API

Bzzmans New Coin Listing Detection Bot Architecture About Project Work in progress. This bot basically gets new coin listings from Binance using Binan

Eyüp Barlas 21 May 31, 2022
Ig-Crackv2 - Crack Instagram Version 2.9

★★ Information ★★ ★★Menu Special Crack Melalui Pengikut Crack Melalui Mengikuti

Risky [ Zero Tow ] 11 Aug 30, 2022
Replacement for the default Dark Sky Home Assistant integration using Pirate Weather

Pirate Weather Integrations This integration is designed to replace the default Dark Sky integration in Home Assistant with a slightly modified, but f

Alexander Rey 129 Jan 06, 2023
Space Bot, a Discord bot built for HackerSpace Club of PES University

Space Bot Space Bot, a Discord bot built for HackerSpace Club of PES University What can Space Bot do? Space Bot allows you to lookup any mentor or to

HackerSpace @PESU 7 Oct 23, 2022
A Bot to Track Kernel Upstreams from kernel.org and Post it on Telegram Channel

Channel Kernel Tracker is the channel where the bot will be sending the updates in. Introduction This is a Telegram Bot to Track Kernel Upstreams kern

Kartikeya Hegde 3 Oct 05, 2021
Telegram Bot to Connect Strangers

Telegram Bot to Connect Strangers How to Run Set your telegram bot token as environment variable TELEGRAM_BOT_TOKEN: export TELEGRAM_BOT_TOKEN=your_t

PyTopia 12 Dec 24, 2022
Скрипт, позволяющий импортировать плейлисты из Spotify, а также обычные треклисты в VK музыку.

vk-music-import Программа для переноса плейлистов из Spotify и текстовых треклистов в VK Музыку. Преимущества: Позволяет быстро импортировать плейлист

Mew Forest 32 Nov 23, 2022
Código para trabalho com o dataset Wine em Python

Um perceptron multicamadas (MLP) é uma rede neural artificial feedforward que gera um conjunto de saídas a partir de um conjunto de entradas. Um MLP é

Hemili Beatriz 1 Jan 08, 2022
IACR Events Scraper

IACR Events Scraper This scrapes https://iacr.org/events/ and exports it as a calendar file. I host a version of this for myself under https://arrrr.c

Karolin Varner 6 May 28, 2022
Rock API is an API that allows you to view rocks and find the ratings on them

Rock API The best Rock API What is Rock API? Rock API is an API that allows you to view rocks and find the ratings on them. However, this isn't a regu

Conos 21 Sep 21, 2022
Elkeid HUB - A rule/event processing engine maintained by the Elkeid Team that supports streaming/offline data processing

Elkeid HUB - A rule/event processing engine maintained by the Elkeid Team that supports streaming/offline data processing

Bytedance Inc. 61 Dec 29, 2022
Amanda-A next gen powerful telegram group manager bot for manage your groups and have fun with other cool modules.

Amanda-A next gen powerful telegram group manager bot for manage your groups and have fun with other cool modules.

Team Amanda 4 Oct 21, 2022
Prabashwara's Pm Bot repository. You can deploy and edit this repository.

Tᴇʟᴇɢʀᴀᴍ Pᴍ Bᴏᴛ | Prabashwara's PM Bot Unmaintained. The new repo of @Pm-Bot is private. (It is no longer based on this source code. The completely re

Rivibibu Prabshwara Ⓒ 2 Jul 05, 2022
N3RP (the NFT Rental Protocol) allows users to trustlessly rent out their ERC721-based assets.

N3RP • N3RP - An NFT Rental Protocol (pronounced "nerp") Smart Contracts Passing Tests, Frontend Functional But Is Being Beautified. 🛠 Introduction T

Grant Stenger 56 Dec 07, 2022