Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
textgrid-python-clients
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
DARIAH-DE
TextGridRep
textgrid-python-clients
Merge requests
!18
Draft: Resolve "provide locking functionality in crud"
Code
Review changes
Check out branch
Download
Patches
Plain diff
Closed
Draft: Resolve "provide locking functionality in crud"
27-provide-locking-functionality-in-crud
into
main
Overview
1
Commits
1
Pipelines
1
Changes
1
Closed
Stefan Hynek
requested to merge
27-provide-locking-functionality-in-crud
into
main
2 years ago
Overview
1
Commits
1
Pipelines
1
Changes
1
Expand
Closes
#27
0
0
Merge request reports
Compare
main
main (base)
and
latest version
latest version
5f7aefa6
1 commit,
2 years ago
1 file
+
32
−
0
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
src/tgclients/crud.py
+
32
−
0
Options
@@ -87,6 +87,38 @@ class TextgridCRUD:
response
.
encoding
=
RESPONSE_ENCODING
return
response
def
lock_resource
(
self
,
sid
:
str
,
textgrid_uri
:
str
):
"""
Lock a Textgrid Resource.
Args:
sid (str): Session ID
textgrid_uri (str): Textgrid URI
Returns:
Response: HTTP response from service
"""
params
=
{
'
sessionId
'
:
sid
}
response
=
requests
.
get
(
self
.
_url
+
'
/
'
+
textgrid_uri
+
'
/lock
'
,
params
=
params
)
response
.
encoding
=
RESPONSE_ENCODING
return
response
def
unlock_resource
(
self
,
sid
:
str
,
textgrid_uri
:
str
):
"""
Unlock a Textgrid Resource.
Args:
sid (str): Session ID
textgrid_uri (str): Textgrid URI
Returns:
Response: HTTP response from service
"""
params
=
{
'
sessionId
'
:
sid
}
response
=
requests
.
get
(
self
.
_url
+
'
/
'
+
textgrid_uri
+
'
/unlock
'
,
params
=
params
)
response
.
encoding
=
RESPONSE_ENCODING
return
response
@staticmethod
def
_prepare_multipart
(
data
,
metadata
):
"""
Create a streaming multipart object.
Loading