Skip to main content

Memento Database Python SDK

This is the python SDK for Memento Database API. Pull requests and bug reports are welcomed.

Latest Version

The latest version of Memento Database API SDK is PyMementoDB-1.0.2

Installation

Install using pip :

$ pip install pymementodb

Get access tokens

Install desktop application and get authorisation token in Account menu.

Include memento in your application

from pymementodb import Memento

Get memento instance

To get an instance of memento just provide the access token.

server = Memento('<access token>')

Optionally, the custom server can be specified.

server = Memento('<access token>', '<memento token>')

Usage

Once you have the access token you can make the calls to the server. Get the memento instance and set the access token and then make authorized calls.

List library info

You can use list_libraries() to list all available libraries and their main info.

server = Memento('<access token>')
libs_info = server.list_libraries()

Get Library

You can use get_library() to get the specific library. It returns a Library object.

server = Memento('<access token>')
lib = server.get_library('<library id>')

Get Entries

You can use get_entries() to get entries of the library. It returns a list of Entry objects.

server = Memento('<access token>')
lib = server.get_entries('<library id>')

Optional parameters:

  • limit (int, all by default) - limits the query result to the limit number of the newest entries
  • field_ids (list of ints, all by default) - include only the specified entry field values in results
  • start_revision (int, oldest by default) - return entries since the provided library revision only

Get Entry

You can use get_entry() to get a specific entry. It returns an Entry object.

server = Memento('<access token>')
entry = server.get_entry('<library id>', '<entry id>')

Create Entry

Use create_entry() to create a new entry. It returns an Entry object that represents the newly created entry.

'<field values>' is the list of dictionaries: [{'id': <field id>, 'value': <field value>}, ...]. Datetime fields to be provided in the '2023-08-31T16:47:00+00:00' format.

server = Memento('<access token>')
new_entry = server.create_entry('<library id>', '<field values>')

Edit Entry

Use edit_entry() to modify a specific entry. It returns an Entry object that represents the modified entry.

server = Memento('<access token>')
server.edit_entry('<library id>', '<entry id>', '<field values>')

Delete Entry

Use delete_entry() to delete a specific entry.

server = Memento('<access token>')
lib = server.delete_entry('<library id>', '<entry id>')

Objects

All objects are derived from dataclasses.dataclass.

Library

Properties:

  1. id
  2. createdTime
  3. modifiedTime
  4. fields
  5. name
  6. owner
  7. revision
  8. size

Entry

Properties:

  1. id
  2. createdTime
  3. modifiedTime
  4. fields
  5. status
  6. author
  7. revision
  8. size

Methods:

  1. get_field_value(field_id) - returns the value of the field.

Field

Properties:

  1. id
  2. name
  3. options
  4. order
  5. role
  6. type

License

MIT

Release files for pymementodb 1.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pymementodb 1.0.2
File Size Uploaded
pymementodb-1.0.2.tar.gz 12.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pymementodb 1.0.2
File Interpreter ABI Platform
pymementodb-1.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 26.0 kB

Release files / pymementodb-1.0.2.tar.gz

Download URL pymementodb-1.0.2.tar.gz
Size 12.3 kB
Tags Source
SHA-256 checksum
How to use checksums
668d949f27fb1db1d35e0a50722aae2287ed0ddf384d01eb907de6f479869f64
BLAKE2b-256 checksum
How to use checksums
1bb7ac67ee304265ebac91d0805acf3e4d12989b61cbb12ba2bb3fde37da7bbe
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.16

Release files / pymementodb-1.0.2-py3-none-any.whl

Download URL pymementodb-1.0.2-py3-none-any.whl
Size 13.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
77b8e18d28b2e3f4be02762c32308d98f7b70ef63d91011d2a56b3484017974d
BLAKE2b-256 checksum
How to use checksums
d5ca48019f809a663dcfa52ab93e5caac03a2dffd423ff9e5310ea64bae62f1e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.16

Release history Release notifications | RSS feed

This release

1.0.2 This release

2 release files

1.0.1

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page