Skip to content

Commit

Permalink
added HTTP index storage provier
Browse files Browse the repository at this point in the history
  • Loading branch information
SharonBrizinov committed Jan 16, 2021
1 parent 9afaa63 commit 8df5c31
Show file tree
Hide file tree
Showing 7 changed files with 414 additions and 45 deletions.
4 changes: 3 additions & 1 deletion packaging/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
PyQt5
PyInstaller
PyInstaller
beautifulsoup4
html5lib
Empty file added src/providers/__init__.py
Empty file.
38 changes: 2 additions & 36 deletions src/providers.py → src/providers/aws_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,41 +5,7 @@
from urllib.parse import urlparse

from utils import show_message_box


def find_provider_class_by_url(url):
if S3StorageProvider.is_provider(url):
return S3StorageProvider
return None

class StorageProvider():
NODE_BATCH_UPDATE_COUNT = 1

def __init__(self, url):
self.url = url
self.should_stop = False

@staticmethod
def is_provider(url):
return False

def check(self):
return True

def get_download_url(self, relative_path):
return relative_path

def hostname(self):
return self.url

def yield_dirlist(self):
pass

def get_default_error_message(self):
pass

def stop(self):
self.should_stop = True
from providers.base_provider import StorageProvider

class S3StorageProvider(StorageProvider):
NODE_BATCH_UPDATE_COUNT = 1000
Expand All @@ -52,7 +18,7 @@ def is_provider(url):
if scheme and "http" in scheme:
return ".amazonaws.com" in url
# If we don't have HTTP we assume it's just a AWS S3 bucket name
return url
return True

# We accept a couple of formats. For example:
# - BUCKET_NAME
Expand Down
30 changes: 30 additions & 0 deletions src/providers/base_provider.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@

class StorageProvider():
NODE_BATCH_UPDATE_COUNT = 1

def __init__(self, url):
self.url = url
self.should_stop = False

@staticmethod
def is_provider(url):
return False

def check(self):
return True

def get_download_url(self, relative_path):
return relative_path

def hostname(self):
return self.url

def yield_dirlist(self):
pass

def get_default_error_message(self):
pass

def stop(self):
self.should_stop = True

Loading

0 comments on commit 8df5c31

Please sign in to comment.