Simple Python client

14 Feb 2017

Dear all,
We talked about clients accessing the collection API - I wrote a short
Python script which uses only the two functions "Give me all
collections" and "Give me all members of a collection" to create a
(recursive) graph out of the content of a collectors API instance in Dot
Visualized with GraphViz, the graph looks like this:
Here is the Python script:
In general, this works only with collections on a local instance because
we can't detect if a member of collection is a collection somewhere
else. Would need to integrate PIT API functionality for that.

  • Tobias Weigel's picture

    Author: Tobias Weigel

    Date: 15 Feb, 2017

    Hi Tom,
    neat and simple - this will make a good slide for the use case discussion!
    Best, Tobias

  • Ulrich Schwardmann's picture

    Author: Ulrich Schwardmann

    Date: 16 Feb, 2017

    Dear Thomas,
    unfortunately this client only works, if the base (in this case presents a
    collection, containing nothing else than all subsequent collections in
    play. So in some sense already the base needs to have a list of all the
    recursion contained in the collection tree. For instance if you would
    move demoCol3 from demoCol1 to demoCol2 and call demoCol1, you will not
    get anything below demoCol2, e.g. demoCol3.
    You need some sort of recursive function call here, like in the script

  • Thomas Zastrow's picture

    Author: Thomas Zastrow

    Date: 16 Feb, 2017

    Hi Ulrich!
    Thanks for the script, and ... yes and no :-)
    My script is also working fine when for example, as you suggested, I
    move the "demoCol3" from "demoCol1" to "demoCol2":
    But of course you are right, the script only works if it is uses the
    "root" of all collections as starting point and then can go through all
    collections and their members. But this is exactly one function our API
    defines :-) ... if the starting point is just an arbitrary collection,
    then indeed your script does the work.
    Anyway, do you want to put your script also into the GitHub repository?
    If so, I can give you write access.

submit a comment