Skip to content

Commit 3bb9c1c

Browse files
committed
fix both README
1 parent 4d6186d commit 3bb9c1c

File tree

2 files changed

+25
-77
lines changed

2 files changed

+25
-77
lines changed

README.md

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,29 @@ pip install elabapi-python
2828

2929
# Usage
3030

31-
See the [examples folder](./examples).
31+
## Getting started
32+
The easiest way to get started is to look at an example script: [00-getting-started.py](./examples/00-getting-started.py).
33+
34+
Find more examples in the [examples folder](./examples).
35+
36+
## Basic concepts
37+
38+
~~~python
39+
import elabapi_python
40+
# Initialize a configuration object from the library
41+
configuration = elabapi_python.Configuration()
42+
# Set the host
43+
configuration.host = "https://eln.example.org/api/v2"
44+
# Create an API client object with our configuration
45+
api_client = elabapi_python.ApiClient(configuration)
46+
# Set the Api Key in Authorization header
47+
api_client.set_default_header(header_name='Authorization', header_value=5-abc123...)
48+
49+
# Depending on your needs, instantiate the correct object with api_client as argument
50+
info_client = elabapi_python.InfoApi(api_client)
51+
exp_client = elabapi_python.ExperimentsApi(api_client)
52+
items_client = elabapi_python.ItemsApi(api_client)
53+
~~~
3254

3355
# Unofficial documentation
3456

examples/README.md

Lines changed: 2 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -1,79 +1,5 @@
11
# Examples for using this library
22

3-
Work in progress!
3+
This folder contains many examples showcasing how to use the library. Start with [00-getting-started.py](./00-getting-started.py).
44

5-
# [00-read-items.py](./00-read-items.py)
6-
7-
Read all items.
8-
9-
# [01-download-timestamp-archive.py](./01-download-timestamp-archive.py)
10-
11-
Download all the timestamp archive zip created in the past 7 days.
12-
13-
# [02-patch-metadata-per-category.py](./02-patch-metadata-per-category.py)
14-
15-
Look for all items of a particular category and patch the metadata if it is empty.
16-
17-
# [03-experiment-file-handling.py](./03-experiment-file-handling.py)
18-
19-
Upload, download and delete a file in an experiment.
20-
21-
# [04-create-teamgroup-add-user.py](./04-create-teamgroup-add-user.py)
22-
23-
Create a teamgroup and add a user in it.
24-
25-
# [05-create-modify-item.py](./05-create-modify-item.py)
26-
27-
Create an item in the database and modify it.
28-
29-
# [06-create-users.py](./06-create-users.py)
30-
31-
Create users in batch.
32-
33-
# [07-patch-sysadmin-settings.py](./07-patch-sysadmin-settings.py)
34-
35-
Patch instance config: modify the settings of the Sysadmin Panel.
36-
37-
# [08-create-items-add-metadata.py](./08-create-items-add-metadata.py)
38-
39-
Read a CSV file for samples, create them in the database with metadata, tags and links.
40-
41-
# [09-import-csv.py](./09-import-csv.py)
42-
43-
Read a CSV file containing a list of antibodies and import them in the resource database using the metadata/extra fields.
44-
45-
# [10-date-time-conversions.py](./10-date-time-conversions.py)
46-
47-
Work with date-time data formats with a demonstration of doing statistics with experiments data.
48-
49-
# [11-resources-categories.py](./11-resources-categories.py)
50-
51-
Create and edit a Resources Category (Items types).
52-
53-
# [12-experiments-export-pdf.py](./12-experiments-export-pdf.py)
54-
55-
Look for all timestamped experiments last week for a particular user and save a pdf locally.
56-
57-
# [13-events.py](./13-events.py)
58-
59-
Get a list of events (booked slots) for the current team.
60-
61-
# [14-fix-user-exp-permissions.py](./14-fix-user-exp-permissions.py)
62-
63-
Look for all experiments of a given user and adjust permissions of their experiments.
64-
65-
# [15-process-csv-metadata-into-csv-column.py](./15-process-csv-metadata-into-csv-column.py)
66-
67-
Take a CSV file created from eLabFTW export function, and for each row, grab the metadata, and create a new CSV where each Extra Field in the metadata is now a column.
68-
69-
# [16-update-users-emails.py](./16-update-users-emails.py)
70-
71-
Take a CSV file that contains a list of old emails to update and their new value, and generate a .sql file that will update theses values in the database.
72-
73-
# [17-csv-metadata-as-columns.py](./17-csv-metadata-as-columns.py)
74-
75-
Take a CSV file created from eLabFTW export function, and creates a new CSV where it extracts the metadata Extra Fields into a new column.
76-
77-
# [18-archive-users.py](./18-archive-users.py)
78-
79-
Archive users that have been inactive for at least 8 months.
5+
All files are commented. Feel free to submit your own examples script in a pull request!

0 commit comments

Comments
 (0)