a python API to communicate with the Scicat API
Project description
Pyscicat
Pyscicat is a python client library for interacting with the SciCat backend. It sends messages to the SciCat backend over HTTP. It currently does not contain any command line interface.
Documentation for Pyscicat is available here.
Basic usage example
from datetime import datetime
from pyscicat.client import ScicatClient
from pyscicat.model import (Ownable, RawDataset, DatasetType, Sample)
# Create a client object. The account used should have the ingestor role in SciCat
client = ScicatClient(base_url="http://localhost/api/v3", username="admin", password="2jf70TPNZsS")
ownable = Ownable(ownerGroup="aGroup", accessGroups=[])
# Create a Dataset object. Notice how we pass the `ownable` instance.
dataset = RawDataset(
size=42,
owner="ingestor",
contactEmail="scicatingestor@your.site",
creationLocation="magrathea",
creationTime=str(datetime.now().isoformat()),
instrumentId="earth",
proposalId="deepthought",
dataFormat="planet",
type=DatasetType.raw,
principalInvestigator="admin",
sourceFolder="/foo/bar",
scientificMetadata={"a": "field"},
sampleId="gargleblaster",
**ownable.model_dump(),
)
dataset_id = client.datasets_create(dataset)
sample = Sample(
sampleId="gargleblaster",
owner="Chamber of Commerce",
description="A legendary drink.",
sampleCharacteristics={"Flavour": "Unknown, but potent"},
isPublished=False,
**ownable.model_dump()
)
sample_id = client.samples_create(sample)
Notes
To develop with SciCatLive, connect to your local running instance with:
client = ScicatClient(base_url="http://localhost/api/v3", username="admin", password="2jf70TPNZsS", auto_login=False)
client._headers["Host"] = "backend.localhost"
client.login()
Then use the client normally.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pyscicat-0.4.8.tar.gz.
File metadata
- Download URL: pyscicat-0.4.8.tar.gz
- Upload date:
- Size: 129.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1f32988a2adac1f49475289e0793ecd62fd9fb695ecffad4da36de584d7c1d37
|
|
| MD5 |
ea03c2136ef205fa7f19f530b73e72d5
|
|
| BLAKE2b-256 |
393cfe1e90dad39ac3037ba057daf3811e4cf4995838a2150d44fce6e554340c
|
File details
Details for the file pyscicat-0.4.8-py3-none-any.whl.
File metadata
- Download URL: pyscicat-0.4.8-py3-none-any.whl
- Upload date:
- Size: 17.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bb67f29094551f3f0e14350d73b899021d02fb5eb1cd839490b3d2c529e203ac
|
|
| MD5 |
8cc4fc72e2ef4d20160f25b8654cc5ee
|
|
| BLAKE2b-256 |
470b2e9001fdd19a5b5c1864f57d90f2ff15eaafd9c04e2888448af0980de1cc
|