EOX GitLab Instance
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
core
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Data Handling
core
Commits
bdedd34c
Commit
bdedd34c
authored
3 years ago
by
Fabian Schindler
Browse files
Options
Downloads
Patches
Plain Diff
Adding HTTP source
parent
faf9e1ed
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Pipeline
#22812
failed
3 years ago
Stage: test
Stage: publish
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
registrar/backend/eoxserver.py
+10
-1
10 additions, 1 deletion
registrar/backend/eoxserver.py
registrar/source.py
+22
-1
22 additions, 1 deletion
registrar/source.py
with
32 additions
and
2 deletions
registrar/backend/eoxserver.py
+
10
−
1
View file @
bdedd34c
...
...
@@ -22,7 +22,7 @@ if TYPE_CHECKING:
from
pystac
import
Item
from
..exceptions
import
RegistrationError
from
..source
import
Source
,
LocalSource
,
S3Source
,
SwiftSource
from
..source
import
HTTPSource
,
Source
,
LocalSource
,
S3Source
,
SwiftSource
from
.abc
import
ItemBackend
...
...
@@ -206,6 +206,15 @@ class EOxServerBackend(ItemBackend):
)
storage_name
=
storage
.
name
elif
isinstance
(
source
,
HTTPSource
):
storage
,
created_storage
=
backends
.
Storage
.
objects
.
get_or_create
(
name
=
source
.
name
,
url
=
source
.
endpoint_url
,
storage_type
=
"
http
"
,
# TODO: maybe add storage auth at some point
)
storage_name
=
storage
.
name
if
created_storage_auth
:
logger
.
info
(
"
Created storage auth
"
,
source
=
source
.
name
)
if
created_storage
:
...
...
This diff is collapsed.
Click to expand it.
registrar/source.py
+
22
−
1
View file @
bdedd34c
...
...
@@ -11,10 +11,12 @@ from os.path import normpath, join, isabs
import
shutil
from
glob
import
glob
from
fnmatch
import
fnmatch
import
requests
import
structlog
from
typing
import
TYPE_CHECKING
,
Optional
from
abc
import
ABC
,
abstractmethod
from
urllib.parse
import
urlparse
from
urllib.parse
import
urljoin
,
urlparse
import
boto3
import
boto3.session
...
...
@@ -369,10 +371,29 @@ class LocalSource(Source):
return
{},
self
.
_join_path
(
path
)
class
HTTPSource
(
Source
):
def
get_container_and_path
(
self
,
path
:
str
):
return
(
self
.
endpoint_url
,
path
)
def
list_files
(
self
,
path
:
str
,
glob_pattern
:
list
=
None
):
raise
NotImplementedError
()
def
get_file
(
self
,
path
:
str
,
target_path
:
str
):
url
=
urljoin
(
self
.
endpoint_url
,
path
)
response
=
requests
.
get
(
url
,
allow_redirects
=
True
)
with
open
(
target_path
,
"
w
"
)
as
f
:
f
.
write
(
response
.
content
)
@abstractmethod
def
get_vsi_env_and_path
(
self
,
path
:
str
):
return
{},
f
"
/vsicurl/
{
urljoin
(
self
.
endpoint_url
,
path
)
}
"
SOURCE_TYPES
=
{
"
swift
"
:
SwiftSource
,
"
s3
"
:
S3Source
,
"
local
"
:
LocalSource
,
"
http
"
:
HTTPSource
,
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment