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
!77
Resolve "add get-uri API call to tgcrud"
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Resolve "add get-uri API call to tgcrud"
101-add-get-uri-api-call-to-tgcrud
into
main
Overview
0
Commits
2
Pipelines
2
Changes
4
Merged
Ubbo Veentjer
requested to merge
101-add-get-uri-api-call-to-tgcrud
into
main
7 months ago
Overview
0
Commits
2
Pipelines
2
Changes
4
Expand
Closes
#101 (closed)
0
0
Merge request reports
Compare
main
version 1
d6f55ffb
7 months ago
main (base)
and
latest version
latest version
893964a9
2 commits,
7 months ago
version 1
d6f55ffb
1 commit,
7 months ago
4 files
+
71
−
0
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
4
Search (e.g. *.vue) (Ctrl+P)
src/tgclients/crud.py
+
43
−
0
Options
@@ -157,6 +157,30 @@ class TextgridCrudRequest:
)
return
self
.
_handle_response
(
response
)
def
get_uri
(
self
,
sid
:
str
,
how_many
:
int
)
->
Response
:
"""
Get TextGrid URIs.
Get an specified amount of TextGrid URIs for assigning to new TextGrid objects.
Useful e.g. for bulk imports.
Args:
sid (str): Session ID
how_many (int): number of URIs to generate
Raises:
TextgridCrudException: if HTTP status code >= 400
Returns:
Response: HTTP response from service with TextGrid URIs in body
"""
params
=
{
'
sessionId
'
:
sid
,
'
howMany
'
:
how_many
}
response
=
self
.
_requests
.
get
(
self
.
_url
+
'
/getUri
'
,
params
=
params
,
timeout
=
self
.
_config
.
http_timeout
,
)
return
self
.
_handle_response
(
response
)
def
update_resource
(
# noqa: PLR0913
self
,
sid
:
str
,
@@ -383,6 +407,25 @@ class TextgridCrud(TextgridCrudRequest):
response
=
super
().
create_revision
(
sid
,
project_id
,
textgrid_uri
,
data
,
metadata_string
)
return
self
.
_parser
.
parse
(
BytesIO
(
response
.
content
),
MetadataContainerType
)
def
get_uri
(
self
,
sid
:
str
,
how_many
:
int
)
->
list
:
"""
Get TextGrid URIs.
Get an specified amount of TextGrid URIs for assigning to new TextGrid objects.
Useful e.g. for bulk imports.
Args:
sid (str): Session ID
how_many (int): number of URIs to generate
Raises:
TextgridCrudException: if HTTP status code >= 400
Returns:
list: List with TextGrid URIs
"""
response
=
super
().
get_uri
(
sid
=
sid
,
how_many
=
how_many
)
return
response
.
text
.
splitlines
()
def
read_metadata
(
self
,
textgrid_uri
:
str
,
sid
:
Optional
[
str
]
=
None
)
->
MetadataContainerType
:
"""
Read Metadata.
Loading