diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..8cd0df3 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,2 @@ +.vscode +.idea \ No newline at end of file diff --git a/.gitignore b/.gitignore index 06c39ae..14d5f96 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ /.idea/ +/.vscode/ /venv/ db.sqlite3 djangoapp.log \ No newline at end of file diff --git a/.gitmodules b/.gitmodules index 2c1f80d..989f572 100644 --- a/.gitmodules +++ b/.gitmodules @@ -2,18 +2,6 @@ path = pullgerFootPrint/com/linkedin url = https://github.com/PullgerFootPrint/com--linkedin.git branch = NeoUKRcd -[submodule "pullgerMultisessionManager"] - path = pullgerMultisessionManager - url = https://github.com/Pullger/pullgerMultisessionManager.git - branch = NeoUKR -[submodule "pullgerMultisessionManager_FRONT"] - path = pullgerMultisessionManager_FRONT - url = https://github.com/Pullger/pullgerMultisessionManager_FRONT.git - branch = NeoUKR -[submodule "pullgerMultisessionManager_REST"] - path = pullgerMultisessionManager_REST - url = https://github.com/Pullger/pullgerMultisessionManager_REST.git - branch = NeoUKR [submodule "pullgerDomain/com/linkedin"] path = pullgerDomain/com/linkedin url = https://github.com/PullgerDomain/com--linkedin.git @@ -50,3 +38,19 @@ path = pullgerReflection/com_linkedin__TT url = https://github.com/PullgerReflection/com_linkedin__TT.git branch = NeoUKR +[submodule "pullgerReflection/com_linkedin__REST"] + path = pullgerReflection/com_linkedin__REST + url = https://github.com/PullgerReflection/com_linkedin__REST.git + branch = NeoUKR +[submodule "pullgerMultiSessionManager"] + path = pullgerMultiSessionManager + url = https://github.com/Pullger/pullgerMultiSessionManager.git + branch = NeoUKR +[submodule "pullgerMultiSessionManager__REST"] + path = pullgerMultiSessionManager__REST + url = https://github.com/Pullger/pullgerMultiSessionManager__REST.git + branch = NeoUKR +[submodule "pullgerInternalControl"] + path = pullgerInternalControl + url = https://github.com/Pullger/pullgerInternalControl.git + branch = NeoUKR diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..d560ddb --- /dev/null +++ b/Dockerfile @@ -0,0 +1,54 @@ +# Python and Linux Version +# FROM python:3.10.0a1-alpine3.12 +FROM python:3.11.0rc2-bullseye + +# Set environment variables +ENV PYTHONDONTWRITEBYTECODE 1 +ENV PYTHONUNBUFFERED 1 + +COPY requirements.txt /app/requirements.txt + +# Configure server +# RUN set -ex \ +# && pip install --upgrade pip \ +# && pip install --no-cache-dir -r /app/requirements.txt + +RUN ["apt-get", "update"] +RUN ["apt-get", "-y", "install", "vim"] + +# Install chrome driver and selenium +RUN mkdir ./app/tmp/ +WORKDIR /app/tmp + +RUN version=$(curl -s "https://chromedriver.storage.googleapis.com/LATEST_RELEASE") && \ + wget -qP /app/tmp/ "https://chromedriver.storage.googleapis.com/${version}/chromedriver_linux64.zip" +RUN unzip -o chromedriver_linux64.zip -d /usr/local/bin +RUN chmod 755 /usr/local/bin/chromedriver + +RUN ["wget", "https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb"] +RUN apt-get -y install /app/tmp/google-chrome-stable_current_amd64.deb + + + +# Install libraries +RUN pip install --upgrade pip +RUN pip install -r /app/requirements.txt + +# Working directory +WORKDIR /app + +ADD . . + +# RUN python3 manage.py test pullgerReflection.com_linkedin.tests.end_to_end + +# EXPOSE 8000 + +# CMD ["gunicorn", "--bind", ":8000", "--workers", "3", "core.wsgi:application"] + +# CMD gunicorn config.wsgi:application --bind 0.0.0.0:$PORT + +# CMD ["gunicorn", "config.wsgi:application", "--bind", "0.0.0.0:$PORT"] + +CMD python manage.py runserver 0.0.0.0:$PORT + +# CMD ["bash"] \ No newline at end of file diff --git a/Dockerfile.debug b/Dockerfile.debug new file mode 100644 index 0000000..477d4b8 --- /dev/null +++ b/Dockerfile.debug @@ -0,0 +1,50 @@ +# Python and Linux Version +# FROM python:3.10.0a1-alpine3.12 +FROM python:3.11.0rc2-bullseye + +# Set environment variables +ENV PYTHONDONTWRITEBYTECODE 1 +ENV PYTHONUNBUFFERED 1 + +COPY requirements.txt /app/requirements.txt + +# Configure server +# RUN set -ex \ +# && pip install --upgrade pip \ +# && pip install --no-cache-dir -r /app/requirements.txt + +RUN ["apt-get", "update"] +RUN ["apt-get", "-y", "install", "vim"] + +# Install chrome driver and selenium +RUN mkdir ./app/tmp/ +WORKDIR /app/tmp + +RUN version=$(curl -s "https://chromedriver.storage.googleapis.com/LATEST_RELEASE") && \ + wget -qP /app/tmp/ "https://chromedriver.storage.googleapis.com/${version}/chromedriver_linux64.zip" +RUN unzip -o chromedriver_linux64.zip -d /usr/local/bin +RUN chmod 755 /usr/local/bin/chromedriver + +RUN ["wget", "https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb"] +RUN apt-get -y install /app/tmp/google-chrome-stable_current_amd64.deb + + + +# Install libraries +RUN pip install --upgrade pip +RUN pip install -r /app/requirements.txt + +# Working directory +WORKDIR /app + +ADD . . + +# RUN python3 manage.py test pullgerReflection.com_linkedin.tests.end_to_end + +# EXPOSE 8000 + +# CMD ["gunicorn", "--bind", ":8000", "--workers", "3", "core.wsgi:application"] + +# CMD gunicorn config.wsgi:application --bind 0.0.0.0:8000 + +CMD ["bash"] \ No newline at end of file diff --git a/Dockerfile.test b/Dockerfile.test new file mode 100644 index 0000000..da29c87 --- /dev/null +++ b/Dockerfile.test @@ -0,0 +1,50 @@ +# Python and Linux Version +# FROM python:3.10.0a1-alpine3.12 +FROM python:3.11.0rc2-bullseye + +# Set environment variables +ENV PYTHONDONTWRITEBYTECODE 1 +ENV PYTHONUNBUFFERED 1 + +COPY requirements.txt /app/requirements.txt + +# Configure server +# RUN set -ex \ +# && pip install --upgrade pip \ +# && pip install --no-cache-dir -r /app/requirements.txt + +RUN ["apt-get", "update"] +RUN ["apt-get", "-y", "install", "vim"] + +# Install chrome driver and selenium +RUN mkdir ./app/tmp/ +WORKDIR /app/tmp + +RUN version=$(curl -s "https://chromedriver.storage.googleapis.com/LATEST_RELEASE") && \ + wget -qP /app/tmp/ "https://chromedriver.storage.googleapis.com/${version}/chromedriver_linux64.zip" +RUN unzip -o chromedriver_linux64.zip -d /usr/local/bin +RUN chmod 755 /usr/local/bin/chromedriver + +RUN ["wget", "https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb"] +RUN apt-get -y install /app/tmp/google-chrome-stable_current_amd64.deb + + + +# Install libraries +RUN pip install --upgrade pip +RUN pip install -r /app/requirements.txt + +# Working directory +WORKDIR /app + +ADD . . + +# RUN python3 manage.py test pullgerReflection.com_linkedin.tests.end_to_end + +# CMD ["gunicorn", "--bind", ":8000", "--workers", "3", "core.wsgi:application"] + +# CMD gunicorn config.wsgi:application --bind 0.0.0.0:8000 + +EXPOSE 8000 + +CMD ["bash","test_script.sh"] \ No newline at end of file diff --git a/config/__init__.py b/config/__init__.py index e69de29..ebdd3cf 100644 --- a/config/__init__.py +++ b/config/__init__.py @@ -0,0 +1 @@ +from .version import * \ No newline at end of file diff --git a/config/__pycache__/__init__.cpython-38.pyc b/config/__pycache__/__init__.cpython-38.pyc new file mode 100644 index 0000000..9fa83b6 Binary files /dev/null and b/config/__pycache__/__init__.cpython-38.pyc differ diff --git a/config/__pycache__/asgi.cpython-38.pyc b/config/__pycache__/asgi.cpython-38.pyc new file mode 100644 index 0000000..1fc7987 Binary files /dev/null and b/config/__pycache__/asgi.cpython-38.pyc differ diff --git a/config/__pycache__/settings.cpython-38.pyc b/config/__pycache__/settings.cpython-38.pyc new file mode 100644 index 0000000..31dd796 Binary files /dev/null and b/config/__pycache__/settings.cpython-38.pyc differ diff --git a/config/__pycache__/urls.cpython-38.pyc b/config/__pycache__/urls.cpython-38.pyc new file mode 100644 index 0000000..58d7595 Binary files /dev/null and b/config/__pycache__/urls.cpython-38.pyc differ diff --git a/config/__pycache__/version.cpython-38.pyc b/config/__pycache__/version.cpython-38.pyc new file mode 100644 index 0000000..34a1635 Binary files /dev/null and b/config/__pycache__/version.cpython-38.pyc differ diff --git a/config/__pycache__/wsgi.cpython-38.pyc b/config/__pycache__/wsgi.cpython-38.pyc new file mode 100644 index 0000000..7596c10 Binary files /dev/null and b/config/__pycache__/wsgi.cpython-38.pyc differ diff --git a/config/settings.py b/config/settings.py index 5052cc3..456840a 100644 --- a/config/settings.py +++ b/config/settings.py @@ -26,7 +26,7 @@ # SECURITY WARNING: don't run with debug turned on in production! DEBUG = True -ALLOWED_HOSTS = [] +ALLOWED_HOSTS = ['*'] # Application definition @@ -42,17 +42,19 @@ PROJECT_INSTALLED_APPS = [ 'pullgerAccountManager', + 'pullgerAccountManager__REST', 'pullgerAuthJWT', - 'pullgerMultisessionManager', - 'pullgerMultisessionManager_REST', - 'pullgerMultisessionManager_FRONT', + 'pullgerMultiSessionManager', + 'pullgerMultiSessionManager__REST', 'pullgerReflection.com_linkedin', 'pullgerReflection.com_linkedin__TT', + 'pullgerDevelopmentFramework' ] EXTERNAL_INSTALLED_APPS = [ 'rest_framework', 'rest_framework.authtoken', + 'corsheaders', ] INSTALLED_APPS = STANDARD_INSTALLED_APPS + PROJECT_INSTALLED_APPS + EXTERNAL_INSTALLED_APPS @@ -65,6 +67,8 @@ 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', + 'corsheaders.middleware.CorsMiddleware', + 'django.middleware.common.CommonMiddleware' ] ROOT_URLCONF = 'config.urls' @@ -146,7 +150,9 @@ # Disable Django's logging setup LOGGING_CONFIG = None -LOGLEVEL = os.environ.get('LOGLEVEL', 'INFO').upper() +# LOGLEVEL = os.environ.get('LOGLEVEL', 'INFO').upper() +LOGLEVEL = os.environ.get('LOGLEVEL', 'DEBUG').upper() + logging.config.dictConfig({ 'version': 1, @@ -155,20 +161,21 @@ 'default': { # exact format is not important, this is the minimum information # 'format': '%(asctime)s %(name)-12s %(levelname)-8s %(message)s', - 'format': '%(levelname)s %(asctime)s - %(name)s\n\t{process: %(process)s module: [%(module)s] line: %(lineno)d}\n\t%(relativeCreated)6d %(threadName)s\n\t\t%(message)s' + # 'format': '%(levelname)s %(asctime)s - %(name)s\n\treg uuid: %(reg)s\n\tfunction: [%(call_func)s] line: %(call_line)d module: [%(call_file)s]\n\tprocess: %(process)s relative: %(relativeCreated)6d %(threadName)s\n\t\t%(message)s' + 'format': '%(levelname)s %(asctime)s - %(name)s\n\tprocess: %(process)s relative: %(relativeCreated)6d %(threadName)s\n\t\t%(message)s' }, 'django.server': DEFAULT_LOGGING['formatters']['django.server'], }, 'handlers': { 'file': { - 'level': 'DEBUG', + 'level': 'INFO', 'class': 'logging.FileHandler', 'formatter': 'default', - 'filename': 'djangoapp.log', + 'filename': './log/djangoapp.log', }, # console logs to stderr 'console': { - 'level': 'WARNING', + 'level': 'DEBUG', 'class': 'logging.StreamHandler', 'formatter': 'default', }, @@ -179,6 +186,7 @@ '': { 'level': LOGLEVEL, 'handlers': ['file'], + # 'handlers': ['file'], }, # Our application code # 'app': { @@ -196,4 +204,8 @@ 'DEFAULT_AUTHENTICATION_CLASSES': [ 'rest_framework.authentication.TokenAuthentication', ], -} \ No newline at end of file +} + +# TEMP_BASE_DIR = Path(__file__).resolve().parent.parent + +CORS_ORIGIN_ALLOW_ALL = True \ No newline at end of file diff --git a/config/urls.py b/config/urls.py index 73eb899..6122b9a 100644 --- a/config/urls.py +++ b/config/urls.py @@ -3,7 +3,9 @@ urlpatterns = [ path('admin/', admin.site.urls), - path('pullgerMM/', include('pullgerMultisessionManager_FRONT.urls')), - path('pullgerMM/api/', include('pullgerMultisessionManager_REST.urls')), + # path('pullgerMM/', include('pullgerMultiSessionManager__FRONT.urls')), + path('pullgerMSM/api/', include('pullgerMultiSessionManager__REST.urls')), + path('pullgerAM/api/', include('pullgerAccountManager__REST.urls')), + path('pullgerR/com_linkedin/api/', include('pullgerReflection.com_linkedin__REST.urls')), path('api/account/', include('pullgerAuthJWT.urls')), ] diff --git a/config/version.history b/config/version.history new file mode 100644 index 0000000..6672b0d --- /dev/null +++ b/config/version.history @@ -0,0 +1,23 @@ +Version history [pullgerLinkedIN_FULL] + +{0.2.0.0} [pullgerLinkedIN_FULL] + - cumulative update + +{0.1.2.0} [pullgerLinkedIN_FULL] + - fixing + +{0.1.1.0} [pullgerLinkedIN_FULL] + - add submodule [pullgerInternalControl] + +{0.1.0.0} [pullgerLinkedIN_FULL] + - cumulative update + +{0.0.3.0} [pullgerLinkedIN_FULL] + - [pullgerMultiSessionManager] {0.0.3.0} + +{0.0.2.0} [pullgerLinkedIN_FULL] + - [pullgerExceptions] {0.0.1.0} + - [pullgerReflection/com_linkedin__TT] {0.0.2.1} + - [pullgerReflection/com_linkedin] {0.0.5.1} + +{0.0.1.0} [pullgerLinkedIN_FULL] \ No newline at end of file diff --git a/config/version.py b/config/version.py index 315a088..6c1bba4 100644 --- a/config/version.py +++ b/config/version.py @@ -1,10 +1,3 @@ -VERSION = (0, 0, 2, 0) +VERSION = (0, 2, 0, 0) VERSION_INFO = '.'.join(str(nv) for nv in VERSION) __version__ = VERSION_INFO - -# 0.0.2.0 -# [pullgerExceptions] {0.0.1.0} -# [pullgerReflection/com_linkedin__TT] {0.0.2.1} -# [pullgerReflection/com_linkedin] {0.0.5.1} - -# 0.0.1.0 \ No newline at end of file diff --git a/djTaskBrocker b/djTaskBrocker index 4e3c129..d0ed380 160000 --- a/djTaskBrocker +++ b/djTaskBrocker @@ -1 +1 @@ -Subproject commit 4e3c129c74090fd22d50ad42d9ca980b4bd7430b +Subproject commit d0ed3801191808e8c9d0cba7b2734e55b7b05d48 diff --git a/docker.sh b/docker.sh new file mode 100644 index 0000000..22ac583 --- /dev/null +++ b/docker.sh @@ -0,0 +1,2 @@ +docker build -t linked_dj . +docker run --rm -t -i -p 8000:8000 linked_dj \ No newline at end of file diff --git a/install_windows.bat b/install_windows.bat new file mode 100644 index 0000000..7e7c05d --- /dev/null +++ b/install_windows.bat @@ -0,0 +1,4 @@ +python manage.py -r requirement.txt +python manage.py makemigrations pullgerAccountManager +python manage.py migrate +python manage.py createsuperuser \ No newline at end of file diff --git a/pullgerAccountManager b/pullgerAccountManager index eca2cc3..bcf0a04 160000 --- a/pullgerAccountManager +++ b/pullgerAccountManager @@ -1 +1 @@ -Subproject commit eca2cc31f485c3261c785f577e1242b447e00b0e +Subproject commit bcf0a044d7747d8783d3c8450b49de07f8f93bde diff --git a/pullgerAccountManager__REST/.gitignore b/pullgerAccountManager__REST/.gitignore new file mode 100644 index 0000000..ed8ebf5 --- /dev/null +++ b/pullgerAccountManager__REST/.gitignore @@ -0,0 +1 @@ +__pycache__ \ No newline at end of file diff --git a/pullgerAccountManager__REST/README.md b/pullgerAccountManager__REST/README.md new file mode 100644 index 0000000..4345928 --- /dev/null +++ b/pullgerAccountManager__REST/README.md @@ -0,0 +1 @@ +# pullgerMultiSessionManager_REST diff --git a/pullgerAccountManager__REST/__init__.py b/pullgerAccountManager__REST/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/pullgerAccountManager__REST/apiREST.py b/pullgerAccountManager__REST/apiREST.py new file mode 100644 index 0000000..45889c8 --- /dev/null +++ b/pullgerAccountManager__REST/apiREST.py @@ -0,0 +1,145 @@ +from rest_framework import status +from rest_framework.views import APIView +from rest_framework.decorators import api_view, permission_classes +from rest_framework.response import Response +from rest_framework.permissions import AllowAny, IsAuthenticated +from pullgerAccountManager import apiAM +from pullgerInternalControl.pullgerAccountManager import api as exceptions +from . import serializers +import logging + + +class Ping(APIView): + permission_classes = (AllowAny,) + + def get(self, request): + content ={'message': 'Pong. Account Manager.'} + return Response(content) + + +class PingAuth(APIView): + permission_classes = (IsAuthenticated,) + + def get(self, request): + content = {'message': 'Pong. Account Manager.'} + return Response(content) + + +@api_view(['GET', 'POST']) +@permission_classes([IsAuthenticated]) +def get_account_list(request): + logger = logging.getLogger('pullgerAccountManager.REST.getAccountList') + + if request.method == 'GET': + accountList = apiAM.get_account_list() + + serializedContent = serializers.AccountListSerializer(accountList, many=True) + content ={'message': 'OK', 'data': serializedContent.data} + + response = Response(content) + response['Cache-Control'] = 'no-cache' + + return response + elif request.method == 'POST': + returnMessage = '' + requestData = request.data.copy() + + content = { + 'message': 'OK', + 'data': {} + } + + parameters = {} + # -----------------login---------------- + login = requestData.get('login') + if login is None: + returnMessage = returnMessage + "[Login] is required field." + else: + parameters['login'] = login + # -------------------password--------------- + password = requestData.get('password') + if password is None: + returnMessage = returnMessage + "[Password] is required field." + else: + parameters['password'] = password + # --------------------authorization--------------- + authorization = requestData.get('authorization') + if authorization is None: + returnMessage = returnMessage + "[Authorization] is required field." + else: + parameters['authorization'] = authorization + # -------------------------------------------------- + + if returnMessage != '': + if 'password' in requestData: + requestData['password'] = '*****' + + statusResp = status.HTTP_400_BAD_REQUEST + logger.info({'requestData': requestData, 'discription': returnMessage, 'path': request.stream.path}) + else: + try: + newUUID = apiAM.add_account(**parameters) + content['data']['uuid'] = newUUID + statusResp = status.HTTP_200_OK + returnMessage = 'OK' + except exceptions.IncorrectInputData as e: + statusResp = status.HTTP_400_BAD_REQUEST + returnMessage = str(e) + requestData['password'] = '*****' + logger.info({'requestData': requestData, 'description': returnMessage, 'path': request.stream.path}) + except BaseException as e: + statusResp = status.HTTP_500_INTERNAL_SERVER_ERROR + requestData['password'] = '*****' + logger.error({'requestData':requestData , 'description': str(e), 'path': request.stream.path}) + returnMessage = 'Internal system error. Contact to support.' + + content['message'] = returnMessage + + return Response(content, status=statusResp) + + +# @api_view(['GET', 'POST']) +# @permission_classes([IsAuthenticated]) +# def pingParam(request, uuid): +# if request.method == 'GET': +# content = {'message': 'GET Pong:' + uuid} +# return Response(content) +# elif request.method == 'POST': +# content = {'message': 'POST Pong:' + uuid} +# return Response(content) +# +# @api_view(['DELETE']) +# @permission_classes([IsAuthenticated]) +# def sessionOperations(request, uuid): +# if request.method == 'DELETE': +# statusResp = status.HTTP_200_OK +# try: +# api.killSession(uuid=uuid) +# content = {'message': f'Session {uuid} deleted:'} +# except: +# content = {'message': 'error'} +# statusResp = status.HTTP_500_INTERNAL_SERVER_ERROR +# +# return Response(content, status=statusResp) +# +# @api_view(['GET', 'POST']) +# @permission_classes([IsAuthenticated]) +# def sessionOperationsGeneral(request): +# if request.method == 'GET': +# sessionList = api.getSessionsList() +# +# serializedContent = serializers.SessionsListSerializer(sessionList, many=True) +# content ={'message': 'OK', 'data': serializedContent.data} +# +# response = Response(content) +# response['Cache-Control'] = 'no-cache' +# +# return response +# elif request.method == 'POST': +# try: +# api.addNewSession() +# content = {'message': 'Session added'} +# except BaseException as e: +# content ={'message': f'error: {str(e)}'} +# +# return Response(content) \ No newline at end of file diff --git a/pullgerAccountManager__REST/apps.py b/pullgerAccountManager__REST/apps.py new file mode 100644 index 0000000..7a7b0e9 --- /dev/null +++ b/pullgerAccountManager__REST/apps.py @@ -0,0 +1,6 @@ +from django.apps import AppConfig + +class MultisessionManagerCoreConfig(AppConfig): + default_auto_field = 'django.db.models.BigAutoField' + name = 'pullgerAccountManager__REST' + multisessionManager = None \ No newline at end of file diff --git a/pullgerAccountManager__REST/serializers.py b/pullgerAccountManager__REST/serializers.py new file mode 100644 index 0000000..43ef977 --- /dev/null +++ b/pullgerAccountManager__REST/serializers.py @@ -0,0 +1,13 @@ +from rest_framework import serializers + + +class AccountListSerializer(serializers.BaseSerializer): + + def to_representation(self, instance): + return { + 'uuid': str(instance.uuid), + 'authorization': str(instance.authorization), + 'login': str(instance.login), + 'active': str(instance.active), + 'use': str(instance.use), + } \ No newline at end of file diff --git a/pullgerAccountManager__REST/tests/__init__.py b/pullgerAccountManager__REST/tests/__init__.py new file mode 100644 index 0000000..a350afd --- /dev/null +++ b/pullgerAccountManager__REST/tests/__init__.py @@ -0,0 +1 @@ +from .unit import * \ No newline at end of file diff --git a/pullgerAccountManager__REST/tests/tools/__init__.py b/pullgerAccountManager__REST/tests/tools/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/pullgerAccountManager__REST/tests/tools/unitOperationsAMRest/__init__.py b/pullgerAccountManager__REST/tests/tools/unitOperationsAMRest/__init__.py new file mode 100644 index 0000000..27fba57 --- /dev/null +++ b/pullgerAccountManager__REST/tests/tools/unitOperationsAMRest/__init__.py @@ -0,0 +1,26 @@ +from rest_framework.test import APITestCase +from pullgerAccountManager.tests.tools import dataTemplatesAM + + +def add_account_for_linkedin(self: APITestCase): + self.client.credentials(HTTP_AUTHORIZATION="Token " + self.token) + + LIA_Template = dataTemplatesAM.LinkedInAccount() + LIA_Template['authorization'] = 'linkedin.general' + + resultGet = self.client.post('/pullgerAM/api/account/', LIA_Template) + self.assertEqual(resultGet.status_code, 200, "General API Critical error with authentification.") + uuidNew = resultGet.data['data']['uuid'] + self.assertEqual(len(uuidNew), 36, "incorrect uuid") + + resultGet = self.client.get("/pullgerAM/api/account/") + self.assertEqual(resultGet.status_code, 200, "General API Critical error with authentification.") + + self.assertEqual(len(resultGet.data['data']), 1, "Incorrect ADD account.") + + for curAccount in resultGet.data['data']: + self.assertEqual(curAccount['uuid'], uuidNew, 'Incorrect uuid in list.') + self.assertEqual(LIA_Template['login'], curAccount['login'], 'Login information.') + self.assertEqual(LIA_Template['authorization'], curAccount['authorization'], 'Login information.') + self.assertEqual(True, bool(curAccount['active']), 'Incorrect value [active].') + self.assertEqual(True, bool(curAccount['use']), 'Incorrect value [use].') diff --git a/pullgerAccountManager__REST/tests/unit.py b/pullgerAccountManager__REST/tests/unit.py new file mode 100644 index 0000000..3e995be --- /dev/null +++ b/pullgerAccountManager__REST/tests/unit.py @@ -0,0 +1,21 @@ +from .tools import unitOperationsAMRest +from pullgerAuthJWT.tests import unit as unitAuthJWT +from rest_framework.test import APITestCase + +class Test_000_REST(APITestCase): + + def setUp(self): + unitAuthJWT.UnitOperations.CreateUser(self) + unitAuthJWT.UnitOperations.GetToken(self) + + def test_001_Smoke(self): + resultGet = self.client.get("/pullgerAM/api/ping/") + self.assertEqual(resultGet.status_code, 200, "General API Critical error.") + + self.client.credentials(HTTP_AUTHORIZATION="Token " + self.token) + resultGet = self.client.get("/pullgerAM/api/pingAuth/") + + self.assertEqual(resultGet.status_code, 200, "General API Critical error with authentification.") + + def test_000_AccountAddforLinkedIN(self): + unitOperationsAMRest.add_account_for_linkedin(self) \ No newline at end of file diff --git a/pullgerAccountManager__REST/urls.py b/pullgerAccountManager__REST/urls.py new file mode 100644 index 0000000..f8b9b47 --- /dev/null +++ b/pullgerAccountManager__REST/urls.py @@ -0,0 +1,8 @@ +from django.urls import path +from . import apiREST + +urlpatterns = [ + path('ping/', apiREST.Ping.as_view()), + path('pingAuth/', apiREST.PingAuth.as_view()), + path('account/', apiREST.get_account_list), +] \ No newline at end of file diff --git a/pullgerAuthJWT b/pullgerAuthJWT index c03d63e..97103b9 160000 --- a/pullgerAuthJWT +++ b/pullgerAuthJWT @@ -1 +1 @@ -Subproject commit c03d63e9716683e9420dc4b350a6a24db1d77be4 +Subproject commit 97103b9a489481f8292f519cc43cb74f0c5af6fa diff --git a/pullgerDataSynchronization/__init__.py b/pullgerDataSynchronization/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/pullgerDataSynchronization/dispatch/__init__.py b/pullgerDataSynchronization/dispatch/__init__.py new file mode 100644 index 0000000..681cebd --- /dev/null +++ b/pullgerDataSynchronization/dispatch/__init__.py @@ -0,0 +1,5 @@ + + +def pull_sync(): + def _decorator(class_model): + pass diff --git a/pullgerDevelopmentFramework/__init__.py b/pullgerDevelopmentFramework/__init__.py new file mode 100644 index 0000000..ebdd3cf --- /dev/null +++ b/pullgerDevelopmentFramework/__init__.py @@ -0,0 +1 @@ +from .version import * \ No newline at end of file diff --git a/pullgerDevelopmentFramework/__pycache__/__init__.cpython-38.pyc b/pullgerDevelopmentFramework/__pycache__/__init__.cpython-38.pyc new file mode 100644 index 0000000..2c94a7c Binary files /dev/null and b/pullgerDevelopmentFramework/__pycache__/__init__.cpython-38.pyc differ diff --git a/pullgerDevelopmentFramework/__pycache__/api.cpython-38.pyc b/pullgerDevelopmentFramework/__pycache__/api.cpython-38.pyc new file mode 100644 index 0000000..16c2d88 Binary files /dev/null and b/pullgerDevelopmentFramework/__pycache__/api.cpython-38.pyc differ diff --git a/pullgerDevelopmentFramework/__pycache__/apps.cpython-38.pyc b/pullgerDevelopmentFramework/__pycache__/apps.cpython-38.pyc new file mode 100644 index 0000000..91b5ded Binary files /dev/null and b/pullgerDevelopmentFramework/__pycache__/apps.cpython-38.pyc differ diff --git a/pullgerDevelopmentFramework/__pycache__/core.cpython-38.pyc b/pullgerDevelopmentFramework/__pycache__/core.cpython-38.pyc new file mode 100644 index 0000000..a7e8b95 Binary files /dev/null and b/pullgerDevelopmentFramework/__pycache__/core.cpython-38.pyc differ diff --git a/pullgerDevelopmentFramework/__pycache__/version.cpython-38.pyc b/pullgerDevelopmentFramework/__pycache__/version.cpython-38.pyc new file mode 100644 index 0000000..58fd0fc Binary files /dev/null and b/pullgerDevelopmentFramework/__pycache__/version.cpython-38.pyc differ diff --git a/pullgerDevelopmentFramework/api.py b/pullgerDevelopmentFramework/api.py new file mode 100644 index 0000000..1492235 --- /dev/null +++ b/pullgerDevelopmentFramework/api.py @@ -0,0 +1,26 @@ +from pullgerMultiSessionManager import apiMSM +from pullgerSquirrel.connectors.selenium import connector +from django.apps import apps + + +def sessions_add(): + msm_app = apps.get_app_config('pullgerDevelopmentFramework') + msm_app.development_framework.session_add() + + # msm_app.development_framework.taskStack.delete_task(uuid_task) + # uuid_session = api.add_new_session(conn=connector.chrome.standard) + # session = api.get_session_by_uuid(uuid_session) + + pass + + +def domain_get_list(): + pass + + +def domain_connect(): + pass + + +def domain_add(): + pass diff --git a/pullgerDevelopmentFramework/apps.py b/pullgerDevelopmentFramework/apps.py new file mode 100644 index 0000000..aa56a4d --- /dev/null +++ b/pullgerDevelopmentFramework/apps.py @@ -0,0 +1,14 @@ +import os +from django.apps import AppConfig +from pullgerDevelopmentFramework import core + + +class PullgerDevelopmentFramework(AppConfig): + default_auto_field = 'django.db.models.BigAutoField' + name = 'pullgerDevelopmentFramework' + multi_session_manager = None + + def ready(self): + self.development_framework = core.DevelopmentFrameworkManager() + if os.environ.get('RUN_MAIN') == 'true': + pass diff --git a/pullgerDevelopmentFramework/core.py b/pullgerDevelopmentFramework/core.py new file mode 100644 index 0000000..6181ded --- /dev/null +++ b/pullgerDevelopmentFramework/core.py @@ -0,0 +1,35 @@ +import uuid + +import pullgerSquirrel +from pullgerInternalControl import pIC_pMSM +from pullgerInternalControl import pIC_pD + +from pullgerMultiSessionManager import apiMSM as pMSM_API +from pullgerSquirrel.connectors.selenium import connector +from django.apps import apps + + +class DevelopmentFrameworkManager: + __slots__ = ( + '_sessionsList', 'session_default' + ) + + class _Session: + __slots__ = ('session', 'uuid_session') + + def __init__(self, session, uuid_session): + self.session = session + self.uuid_session = uuid_session + + def __init__(self): + self._sessionsList = [] + self.session_default = None + + def session_add(self): + uuid_session = pMSM_API.add_new_session(conn=connector.chrome.standard) + session = pMSM_API.get_session_by_uuid(uuid_session) + + session_element = self._Session(session, uuid_session) + self._sessionsList.append(session_element) + if self.session_default is None: + self.session_default = session_element diff --git a/pullgerDevelopmentFramework/migrations/0001_initial.py b/pullgerDevelopmentFramework/migrations/0001_initial.py new file mode 100644 index 0000000..3b0f670 --- /dev/null +++ b/pullgerDevelopmentFramework/migrations/0001_initial.py @@ -0,0 +1,22 @@ +# Generated by Django 4.0.6 on 2022-10-16 13:42 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + ] + + operations = [ + migrations.CreateModel( + name='Domains', + fields=[ + ('uuid', models.CharField(max_length=36, primary_key=True, serialize=False)), + ('url', models.CharField(max_length=300)), + ('description', models.CharField(max_length=300)), + ], + ), + ] diff --git a/pullgerDevelopmentFramework/migrations/__init__.py b/pullgerDevelopmentFramework/migrations/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/pullgerDevelopmentFramework/migrations/__pycache__/0001_initial.cpython-38.pyc b/pullgerDevelopmentFramework/migrations/__pycache__/0001_initial.cpython-38.pyc new file mode 100644 index 0000000..e89da9c Binary files /dev/null and b/pullgerDevelopmentFramework/migrations/__pycache__/0001_initial.cpython-38.pyc differ diff --git a/pullgerDevelopmentFramework/migrations/__pycache__/__init__.cpython-38.pyc b/pullgerDevelopmentFramework/migrations/__pycache__/__init__.cpython-38.pyc new file mode 100644 index 0000000..c15d20b Binary files /dev/null and b/pullgerDevelopmentFramework/migrations/__pycache__/__init__.cpython-38.pyc differ diff --git a/pullgerDevelopmentFramework/models/__init__.py b/pullgerDevelopmentFramework/models/__init__.py new file mode 100644 index 0000000..3c71944 --- /dev/null +++ b/pullgerDevelopmentFramework/models/__init__.py @@ -0,0 +1 @@ +from .domains import * diff --git a/pullgerDevelopmentFramework/models/__pycache__/__init__.cpython-38.pyc b/pullgerDevelopmentFramework/models/__pycache__/__init__.cpython-38.pyc new file mode 100644 index 0000000..1456a87 Binary files /dev/null and b/pullgerDevelopmentFramework/models/__pycache__/__init__.cpython-38.pyc differ diff --git a/pullgerDevelopmentFramework/models/__pycache__/domains.cpython-38.pyc b/pullgerDevelopmentFramework/models/__pycache__/domains.cpython-38.pyc new file mode 100644 index 0000000..7c3d68f Binary files /dev/null and b/pullgerDevelopmentFramework/models/__pycache__/domains.cpython-38.pyc differ diff --git a/pullgerDevelopmentFramework/models/domains.py b/pullgerDevelopmentFramework/models/domains.py new file mode 100644 index 0000000..8125641 --- /dev/null +++ b/pullgerDevelopmentFramework/models/domains.py @@ -0,0 +1,36 @@ +from django.db import models +from django.db.models import signals +from django.dispatch import receiver + + +class DomainsManager(models.Manager): + pass + + +class Domains(models.Model): + uuid = models.CharField(max_length=36, primary_key=True) + url = models.CharField(max_length=300, null=False) + description = models.CharField(max_length=300, null=False) + + # id = models.IntegerField(blank=False, null=True) + # nick = models.CharField(max_length=150, null=True) + # + # first_name = models.CharField(max_length=150, null=True) + # second_name = models.CharField(max_length=150, null=True) + # full_name = models.CharField(max_length=300, null=True) + # + # url = models.CharField(max_length=300, null=True) + # discription = models.CharField(max_length=300, null=True) + # + # location = models.CharField(max_length=300, null=True) + # + # date_small_loaded = models.DateField(null=True) + # date_full_loaded = models.DateField(null=True) + + +@receiver(signals.pre_save, sender=Domains) +def add_domain_uuid(sender, instance, **kwargs): + import uuid + + if not instance.uuid: + instance.uuid = str(uuid.uuid1()) diff --git a/pullgerDevelopmentFramework/tests/__init__.py b/pullgerDevelopmentFramework/tests/__init__.py new file mode 100644 index 0000000..8d5befa --- /dev/null +++ b/pullgerDevelopmentFramework/tests/__init__.py @@ -0,0 +1 @@ +from .unit import * diff --git a/pullgerDevelopmentFramework/tests/__pycache__/__init__.cpython-38.pyc b/pullgerDevelopmentFramework/tests/__pycache__/__init__.cpython-38.pyc new file mode 100644 index 0000000..df856fa Binary files /dev/null and b/pullgerDevelopmentFramework/tests/__pycache__/__init__.cpython-38.pyc differ diff --git a/pullgerDevelopmentFramework/tests/unit/__init__.py b/pullgerDevelopmentFramework/tests/unit/__init__.py new file mode 100644 index 0000000..2a1891c --- /dev/null +++ b/pullgerDevelopmentFramework/tests/unit/__init__.py @@ -0,0 +1 @@ +from .general import * diff --git a/pullgerDevelopmentFramework/tests/unit/__pycache__/__init__.cpython-38.pyc b/pullgerDevelopmentFramework/tests/unit/__pycache__/__init__.cpython-38.pyc new file mode 100644 index 0000000..f4073d3 Binary files /dev/null and b/pullgerDevelopmentFramework/tests/unit/__pycache__/__init__.cpython-38.pyc differ diff --git a/pullgerDevelopmentFramework/tests/unit/__pycache__/general.cpython-38.pyc b/pullgerDevelopmentFramework/tests/unit/__pycache__/general.cpython-38.pyc new file mode 100644 index 0000000..a88c671 Binary files /dev/null and b/pullgerDevelopmentFramework/tests/unit/__pycache__/general.cpython-38.pyc differ diff --git a/pullgerDevelopmentFramework/tests/unit/general.py b/pullgerDevelopmentFramework/tests/unit/general.py new file mode 100644 index 0000000..e33e3af --- /dev/null +++ b/pullgerDevelopmentFramework/tests/unit/general.py @@ -0,0 +1,20 @@ +from django.test import TestCase +# from django.apps import apps +# from pullgerMultiSessionManager import api, core +from pullgerDevelopmentFramework import api + + +class Unit_001_GeneralOperation(TestCase): + def test_001_00_00_get_page(self): + + # for i in range(2): + # if i == 0: + # uuid_session = UnitOperations.add_new_session_selenium_standard(self) + # elif i == 1: + # uuid_session = UnitOperations.add_new_session_selenium_headless(self) + + api.sessions_add() + + # uuid_session = UnitOperations.add_new_session_selenium_standard(self) + + pass \ No newline at end of file diff --git a/pullgerDevelopmentFramework/version.history b/pullgerDevelopmentFramework/version.history new file mode 100644 index 0000000..a578b3e --- /dev/null +++ b/pullgerDevelopmentFramework/version.history @@ -0,0 +1,24 @@ +Version history + +{0.2.0.0} [pullgerMultiSessionManager] + --CHANGE--/issues/2-- Functionality of finding html elements and performing operations of them. + - Bring some code to PEP8 standard + - Rebuilding SessionManager to class structure + - Migrate to pullgerInternalControl library from pullgerLogin and pullgerExceptions + +{0.1.2.0} [pullgerMultiSessionManager] + - Transfer exceptions to external library + - Bring the code to PEP8 standard + +{0.1.1.0} [pullgerMultiSessionManager] + - Changed module name to MultiSessionManager + +{0.1.0.0} [pullgerMultiSessionManager] + - add functionality session type of connectors + +{0.0.3.0} [pullgerMultiSessionManager] + - add version control + - fix import module in unit test + +{0.0.2.0} [pullgerMultiSessionManager] + - initialization \ No newline at end of file diff --git a/pullgerDevelopmentFramework/version.py b/pullgerDevelopmentFramework/version.py new file mode 100644 index 0000000..53cd463 --- /dev/null +++ b/pullgerDevelopmentFramework/version.py @@ -0,0 +1,3 @@ +VERSION = (0, 1, 2, 0) +VERSION_INFO = '.'.join(str(nv) for nv in VERSION) +__version__ = VERSION_INFO \ No newline at end of file diff --git a/pullgerDomain/__pycache__/__init__.cpython-38.pyc b/pullgerDomain/__pycache__/__init__.cpython-38.pyc new file mode 100644 index 0000000..6ec1130 Binary files /dev/null and b/pullgerDomain/__pycache__/__init__.cpython-38.pyc differ diff --git a/pullgerDomain/com/linkedin b/pullgerDomain/com/linkedin index e939bf4..451b904 160000 --- a/pullgerDomain/com/linkedin +++ b/pullgerDomain/com/linkedin @@ -1 +1 @@ -Subproject commit e939bf4f18a1c85a616b3104e2cfb74cd5858ef7 +Subproject commit 451b904466ab46d027be477840406b30f52caa82 diff --git a/pullgerExceptions b/pullgerExceptions deleted file mode 160000 index ad035a4..0000000 --- a/pullgerExceptions +++ /dev/null @@ -1 +0,0 @@ -Subproject commit ad035a4eefefeb89c74201bed0ce917db86d8750 diff --git a/pullgerFootPrint/__pycache__/__init__.cpython-38.pyc b/pullgerFootPrint/__pycache__/__init__.cpython-38.pyc new file mode 100644 index 0000000..3dfae3f Binary files /dev/null and b/pullgerFootPrint/__pycache__/__init__.cpython-38.pyc differ diff --git a/pullgerFootPrint/com/linkedin b/pullgerFootPrint/com/linkedin index 78554d8..a27fe00 160000 --- a/pullgerFootPrint/com/linkedin +++ b/pullgerFootPrint/com/linkedin @@ -1 +1 @@ -Subproject commit 78554d8f7a442f5892049dfaa89f34a83c44bd73 +Subproject commit a27fe00ffffeb3ab0c7d3fb55b6c9b494d2fb762 diff --git a/pullgerFramework/__init__.py b/pullgerFramework/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/pullgerInternalControl b/pullgerInternalControl new file mode 160000 index 0000000..eeac175 --- /dev/null +++ b/pullgerInternalControl @@ -0,0 +1 @@ +Subproject commit eeac1759519ea2a26d0600829a4cf2bb84caf345 diff --git a/pullgerLogin/TurnedOff_pullgerMultiSessionManager/REST/__init__.py b/pullgerLogin/TurnedOff_pullgerMultiSessionManager/REST/__init__.py new file mode 100644 index 0000000..b044d9c --- /dev/null +++ b/pullgerLogin/TurnedOff_pullgerMultiSessionManager/REST/__init__.py @@ -0,0 +1,9 @@ +from pullgerLogin.general import PullgerLogging +from . import _loggerTree + + +class LogClass(PullgerLogging): + pass + + +logger = LogClass(_loggerTree) diff --git a/pullgerLogin/TurnedOff_pullgerMultiSessionManager/REST/__pycache__/__init__.cpython-38.pyc b/pullgerLogin/TurnedOff_pullgerMultiSessionManager/REST/__pycache__/__init__.cpython-38.pyc new file mode 100644 index 0000000..7c14067 Binary files /dev/null and b/pullgerLogin/TurnedOff_pullgerMultiSessionManager/REST/__pycache__/__init__.cpython-38.pyc differ diff --git a/pullgerLogin/TurnedOff_pullgerMultiSessionManager/REST/__pycache__/_loggerTree.cpython-38.pyc b/pullgerLogin/TurnedOff_pullgerMultiSessionManager/REST/__pycache__/_loggerTree.cpython-38.pyc new file mode 100644 index 0000000..fab7fc7 Binary files /dev/null and b/pullgerLogin/TurnedOff_pullgerMultiSessionManager/REST/__pycache__/_loggerTree.cpython-38.pyc differ diff --git a/pullgerLogin/TurnedOff_pullgerMultiSessionManager/REST/_loggerTree.py b/pullgerLogin/TurnedOff_pullgerMultiSessionManager/REST/_loggerTree.py new file mode 100644 index 0000000..2552117 --- /dev/null +++ b/pullgerLogin/TurnedOff_pullgerMultiSessionManager/REST/_loggerTree.py @@ -0,0 +1,4 @@ +from .. import _loggerTree + +LOGGER_NAME = 'REST' +LOGGER_NAME_LIST = [*_loggerTree.LOGGER_NAME_LIST, LOGGER_NAME] diff --git a/pullgerLogin/TurnedOff_pullgerMultiSessionManager/__init__.py b/pullgerLogin/TurnedOff_pullgerMultiSessionManager/__init__.py new file mode 100644 index 0000000..b044d9c --- /dev/null +++ b/pullgerLogin/TurnedOff_pullgerMultiSessionManager/__init__.py @@ -0,0 +1,9 @@ +from pullgerLogin.general import PullgerLogging +from . import _loggerTree + + +class LogClass(PullgerLogging): + pass + + +logger = LogClass(_loggerTree) diff --git a/pullgerLogin/TurnedOff_pullgerMultiSessionManager/__pycache__/__init__.cpython-38.pyc b/pullgerLogin/TurnedOff_pullgerMultiSessionManager/__pycache__/__init__.cpython-38.pyc new file mode 100644 index 0000000..709c1e2 Binary files /dev/null and b/pullgerLogin/TurnedOff_pullgerMultiSessionManager/__pycache__/__init__.cpython-38.pyc differ diff --git a/pullgerLogin/TurnedOff_pullgerMultiSessionManager/__pycache__/_loggerTree.cpython-38.pyc b/pullgerLogin/TurnedOff_pullgerMultiSessionManager/__pycache__/_loggerTree.cpython-38.pyc new file mode 100644 index 0000000..4f19ef0 Binary files /dev/null and b/pullgerLogin/TurnedOff_pullgerMultiSessionManager/__pycache__/_loggerTree.cpython-38.pyc differ diff --git a/pullgerLogin/TurnedOff_pullgerMultiSessionManager/_loggerTree.py b/pullgerLogin/TurnedOff_pullgerMultiSessionManager/_loggerTree.py new file mode 100644 index 0000000..be323ed --- /dev/null +++ b/pullgerLogin/TurnedOff_pullgerMultiSessionManager/_loggerTree.py @@ -0,0 +1,4 @@ +from .. import _loggerTree + +LOGGER_NAME = 'pullgerMultiSessionManager' +LOGGER_NAME_LIST = [*_loggerTree.LOGGER_NAME_LIST, LOGGER_NAME] diff --git a/pullgerLogin/TurnedOff_pullgerReflection/REST/__init__.py b/pullgerLogin/TurnedOff_pullgerReflection/REST/__init__.py new file mode 100644 index 0000000..b044d9c --- /dev/null +++ b/pullgerLogin/TurnedOff_pullgerReflection/REST/__init__.py @@ -0,0 +1,9 @@ +from pullgerLogin.general import PullgerLogging +from . import _loggerTree + + +class LogClass(PullgerLogging): + pass + + +logger = LogClass(_loggerTree) diff --git a/pullgerLogin/TurnedOff_pullgerReflection/REST/__pycache__/__init__.cpython-38.pyc b/pullgerLogin/TurnedOff_pullgerReflection/REST/__pycache__/__init__.cpython-38.pyc new file mode 100644 index 0000000..a383ed5 Binary files /dev/null and b/pullgerLogin/TurnedOff_pullgerReflection/REST/__pycache__/__init__.cpython-38.pyc differ diff --git a/pullgerLogin/TurnedOff_pullgerReflection/REST/__pycache__/_loggerTree.cpython-38.pyc b/pullgerLogin/TurnedOff_pullgerReflection/REST/__pycache__/_loggerTree.cpython-38.pyc new file mode 100644 index 0000000..2f2bec2 Binary files /dev/null and b/pullgerLogin/TurnedOff_pullgerReflection/REST/__pycache__/_loggerTree.cpython-38.pyc differ diff --git a/pullgerLogin/TurnedOff_pullgerReflection/REST/_loggerTree.py b/pullgerLogin/TurnedOff_pullgerReflection/REST/_loggerTree.py new file mode 100644 index 0000000..2552117 --- /dev/null +++ b/pullgerLogin/TurnedOff_pullgerReflection/REST/_loggerTree.py @@ -0,0 +1,4 @@ +from .. import _loggerTree + +LOGGER_NAME = 'REST' +LOGGER_NAME_LIST = [*_loggerTree.LOGGER_NAME_LIST, LOGGER_NAME] diff --git a/pullgerLogin/TurnedOff_pullgerReflection/__init__.py b/pullgerLogin/TurnedOff_pullgerReflection/__init__.py new file mode 100644 index 0000000..b044d9c --- /dev/null +++ b/pullgerLogin/TurnedOff_pullgerReflection/__init__.py @@ -0,0 +1,9 @@ +from pullgerLogin.general import PullgerLogging +from . import _loggerTree + + +class LogClass(PullgerLogging): + pass + + +logger = LogClass(_loggerTree) diff --git a/pullgerLogin/TurnedOff_pullgerReflection/__pycache__/__init__.cpython-38.pyc b/pullgerLogin/TurnedOff_pullgerReflection/__pycache__/__init__.cpython-38.pyc new file mode 100644 index 0000000..f0919ce Binary files /dev/null and b/pullgerLogin/TurnedOff_pullgerReflection/__pycache__/__init__.cpython-38.pyc differ diff --git a/pullgerLogin/TurnedOff_pullgerReflection/__pycache__/_loggerTree.cpython-38.pyc b/pullgerLogin/TurnedOff_pullgerReflection/__pycache__/_loggerTree.cpython-38.pyc new file mode 100644 index 0000000..faf46d9 Binary files /dev/null and b/pullgerLogin/TurnedOff_pullgerReflection/__pycache__/_loggerTree.cpython-38.pyc differ diff --git a/pullgerLogin/TurnedOff_pullgerReflection/_loggerTree.py b/pullgerLogin/TurnedOff_pullgerReflection/_loggerTree.py new file mode 100644 index 0000000..4b1467f --- /dev/null +++ b/pullgerLogin/TurnedOff_pullgerReflection/_loggerTree.py @@ -0,0 +1,4 @@ +from .. import _loggerTree + +LOGGER_NAME = 'pullgerReflection' +LOGGER_NAME_LIST = [*_loggerTree.LOGGER_NAME_LIST, LOGGER_NAME] \ No newline at end of file diff --git a/pullgerLogin/TurnedOff_pullgerSquirrel/__init__.py b/pullgerLogin/TurnedOff_pullgerSquirrel/__init__.py new file mode 100644 index 0000000..b044d9c --- /dev/null +++ b/pullgerLogin/TurnedOff_pullgerSquirrel/__init__.py @@ -0,0 +1,9 @@ +from pullgerLogin.general import PullgerLogging +from . import _loggerTree + + +class LogClass(PullgerLogging): + pass + + +logger = LogClass(_loggerTree) diff --git a/pullgerLogin/TurnedOff_pullgerSquirrel/__pycache__/__init__.cpython-38.pyc b/pullgerLogin/TurnedOff_pullgerSquirrel/__pycache__/__init__.cpython-38.pyc new file mode 100644 index 0000000..5dac780 Binary files /dev/null and b/pullgerLogin/TurnedOff_pullgerSquirrel/__pycache__/__init__.cpython-38.pyc differ diff --git a/pullgerLogin/TurnedOff_pullgerSquirrel/__pycache__/_loggerTree.cpython-38.pyc b/pullgerLogin/TurnedOff_pullgerSquirrel/__pycache__/_loggerTree.cpython-38.pyc new file mode 100644 index 0000000..5f1513d Binary files /dev/null and b/pullgerLogin/TurnedOff_pullgerSquirrel/__pycache__/_loggerTree.cpython-38.pyc differ diff --git a/pullgerLogin/TurnedOff_pullgerSquirrel/_loggerTree.py b/pullgerLogin/TurnedOff_pullgerSquirrel/_loggerTree.py new file mode 100644 index 0000000..dd72f40 --- /dev/null +++ b/pullgerLogin/TurnedOff_pullgerSquirrel/_loggerTree.py @@ -0,0 +1,4 @@ +from .. import _loggerTree + +LOGGER_NAME = 'pullgerSquirrel' +LOGGER_NAME_LIST = [*_loggerTree.LOGGER_NAME_LIST, LOGGER_NAME] diff --git a/pullgerLogin/TurnedOff_pullgerSquirrel/connectors/__init__.py b/pullgerLogin/TurnedOff_pullgerSquirrel/connectors/__init__.py new file mode 100644 index 0000000..b044d9c --- /dev/null +++ b/pullgerLogin/TurnedOff_pullgerSquirrel/connectors/__init__.py @@ -0,0 +1,9 @@ +from pullgerLogin.general import PullgerLogging +from . import _loggerTree + + +class LogClass(PullgerLogging): + pass + + +logger = LogClass(_loggerTree) diff --git a/pullgerLogin/TurnedOff_pullgerSquirrel/connectors/__pycache__/__init__.cpython-38.pyc b/pullgerLogin/TurnedOff_pullgerSquirrel/connectors/__pycache__/__init__.cpython-38.pyc new file mode 100644 index 0000000..64a80a0 Binary files /dev/null and b/pullgerLogin/TurnedOff_pullgerSquirrel/connectors/__pycache__/__init__.cpython-38.pyc differ diff --git a/pullgerLogin/TurnedOff_pullgerSquirrel/connectors/__pycache__/_loggerTree.cpython-38.pyc b/pullgerLogin/TurnedOff_pullgerSquirrel/connectors/__pycache__/_loggerTree.cpython-38.pyc new file mode 100644 index 0000000..a570120 Binary files /dev/null and b/pullgerLogin/TurnedOff_pullgerSquirrel/connectors/__pycache__/_loggerTree.cpython-38.pyc differ diff --git a/pullgerLogin/TurnedOff_pullgerSquirrel/connectors/_loggerTree.py b/pullgerLogin/TurnedOff_pullgerSquirrel/connectors/_loggerTree.py new file mode 100644 index 0000000..2da994c --- /dev/null +++ b/pullgerLogin/TurnedOff_pullgerSquirrel/connectors/_loggerTree.py @@ -0,0 +1,4 @@ +from .. import _loggerTree + +LOGGER_NAME = 'connectors' +LOGGER_NAME_LIST = [*_loggerTree.LOGGER_NAME_LIST, LOGGER_NAME] diff --git a/pullgerLogin/TurnedOff_pullgerSquirrel/connectors/selenium/PageOperation/__init__.py b/pullgerLogin/TurnedOff_pullgerSquirrel/connectors/selenium/PageOperation/__init__.py new file mode 100644 index 0000000..b044d9c --- /dev/null +++ b/pullgerLogin/TurnedOff_pullgerSquirrel/connectors/selenium/PageOperation/__init__.py @@ -0,0 +1,9 @@ +from pullgerLogin.general import PullgerLogging +from . import _loggerTree + + +class LogClass(PullgerLogging): + pass + + +logger = LogClass(_loggerTree) diff --git a/pullgerLogin/TurnedOff_pullgerSquirrel/connectors/selenium/PageOperation/_loggerTree.py b/pullgerLogin/TurnedOff_pullgerSquirrel/connectors/selenium/PageOperation/_loggerTree.py new file mode 100644 index 0000000..ef2e100 --- /dev/null +++ b/pullgerLogin/TurnedOff_pullgerSquirrel/connectors/selenium/PageOperation/_loggerTree.py @@ -0,0 +1,4 @@ +from .. import _loggerTree + +LOGGER_NAME = 'PageOperation' +LOGGER_NAME_LIST = [*_loggerTree.LOGGER_NAME_LIST, LOGGER_NAME] diff --git a/pullgerLogin/TurnedOff_pullgerSquirrel/connectors/selenium/__init__.py b/pullgerLogin/TurnedOff_pullgerSquirrel/connectors/selenium/__init__.py new file mode 100644 index 0000000..b044d9c --- /dev/null +++ b/pullgerLogin/TurnedOff_pullgerSquirrel/connectors/selenium/__init__.py @@ -0,0 +1,9 @@ +from pullgerLogin.general import PullgerLogging +from . import _loggerTree + + +class LogClass(PullgerLogging): + pass + + +logger = LogClass(_loggerTree) diff --git a/pullgerLogin/TurnedOff_pullgerSquirrel/connectors/selenium/__pycache__/__init__.cpython-38.pyc b/pullgerLogin/TurnedOff_pullgerSquirrel/connectors/selenium/__pycache__/__init__.cpython-38.pyc new file mode 100644 index 0000000..0fac4df Binary files /dev/null and b/pullgerLogin/TurnedOff_pullgerSquirrel/connectors/selenium/__pycache__/__init__.cpython-38.pyc differ diff --git a/pullgerLogin/TurnedOff_pullgerSquirrel/connectors/selenium/__pycache__/_loggerTree.cpython-38.pyc b/pullgerLogin/TurnedOff_pullgerSquirrel/connectors/selenium/__pycache__/_loggerTree.cpython-38.pyc new file mode 100644 index 0000000..f5211db Binary files /dev/null and b/pullgerLogin/TurnedOff_pullgerSquirrel/connectors/selenium/__pycache__/_loggerTree.cpython-38.pyc differ diff --git a/pullgerLogin/TurnedOff_pullgerSquirrel/connectors/selenium/_loggerTree.py b/pullgerLogin/TurnedOff_pullgerSquirrel/connectors/selenium/_loggerTree.py new file mode 100644 index 0000000..b1e0bb2 --- /dev/null +++ b/pullgerLogin/TurnedOff_pullgerSquirrel/connectors/selenium/_loggerTree.py @@ -0,0 +1,4 @@ +from .. import _loggerTree + +LOGGER_NAME = 'selenium' +LOGGER_NAME_LIST = [*_loggerTree.LOGGER_NAME_LIST, LOGGER_NAME] diff --git a/pullgerLogin/__init__.py b/pullgerLogin/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/pullgerLogin/__pycache__/__init__.cpython-38.pyc b/pullgerLogin/__pycache__/__init__.cpython-38.pyc new file mode 100644 index 0000000..e3da3df Binary files /dev/null and b/pullgerLogin/__pycache__/__init__.cpython-38.pyc differ diff --git a/pullgerLogin/__pycache__/_loggerTree.cpython-38.pyc b/pullgerLogin/__pycache__/_loggerTree.cpython-38.pyc new file mode 100644 index 0000000..79362bd Binary files /dev/null and b/pullgerLogin/__pycache__/_loggerTree.cpython-38.pyc differ diff --git a/pullgerLogin/__pycache__/general.cpython-38.pyc b/pullgerLogin/__pycache__/general.cpython-38.pyc new file mode 100644 index 0000000..61907fa Binary files /dev/null and b/pullgerLogin/__pycache__/general.cpython-38.pyc differ diff --git a/pullgerLogin/_loggerTree.py b/pullgerLogin/_loggerTree.py new file mode 100644 index 0000000..609c197 --- /dev/null +++ b/pullgerLogin/_loggerTree.py @@ -0,0 +1,2 @@ +LOGGER_NAME = '' +LOGGER_NAME_LIST = [] diff --git a/pullgerLogin/general.py b/pullgerLogin/general.py new file mode 100644 index 0000000..b45d0a4 --- /dev/null +++ b/pullgerLogin/general.py @@ -0,0 +1,40 @@ +import logging +import uuid + + +class PullgerLogging: + __slots__ = ('logger', 'logger_name_full') + + class LogRecord: + __slots__ = ('uuid', 'msg_private', 'msg_public') + + def __init__(self, msg_private, msg_public=None): + self.uuid = uuid.uuid4() + self.msg_private = f'REG:[{self.uuid}] {msg_private}' + if msg_public is not None: + self.msg_public = f'{msg_public} More information on server log by REG:[{self.uuid}]' + else: + self.msg_public = None + + def __init__(self, logger_tree): + self.logger_name_full = '.'.join(logger_tree.LOGGER_NAME_LIST) + self.logger = logging.getLogger(self.logger_name_full) + + def debug(self, msg_private, msg_public=None, **kwargs): + logRecord = self.LogRecord(msg_private=msg_private, msg_public=msg_public) + self.logger.debug(msg=logRecord.msg_private, **kwargs) + return logRecord + + def info(self, msg_private, msg_public=None, **kwargs): + logRecord = self.LogRecord(msg_private=msg_private, msg_public=msg_public) + self.logger.info(msg=logRecord.msg_private, **kwargs) + return logRecord + + def error(self, msg='no message', **kwargs): + self.logger.error(msg=msg, **kwargs) + + def critical(self, msg='no message', **kwargs): + self.logger.critical(msg=msg, **kwargs) + + def log(self, level, msg): + self.logger.log(level=level, msg=msg) diff --git a/pullgerMultiSessionManager b/pullgerMultiSessionManager new file mode 160000 index 0000000..4e8c143 --- /dev/null +++ b/pullgerMultiSessionManager @@ -0,0 +1 @@ +Subproject commit 4e8c14394c97d74ed62ec0d81d1b3c1e90471c6c diff --git a/pullgerMultiSessionManager__REST b/pullgerMultiSessionManager__REST new file mode 160000 index 0000000..caf34d7 --- /dev/null +++ b/pullgerMultiSessionManager__REST @@ -0,0 +1 @@ +Subproject commit caf34d7386612e5e9471cc876100808f9caec88d diff --git a/pullgerMultisessionManager b/pullgerMultisessionManager deleted file mode 160000 index fd176f8..0000000 --- a/pullgerMultisessionManager +++ /dev/null @@ -1 +0,0 @@ -Subproject commit fd176f856826597ed1df9b0204694568cbf61fa3 diff --git a/pullgerMultisessionManager_FRONT b/pullgerMultisessionManager_FRONT deleted file mode 160000 index 3bfd246..0000000 --- a/pullgerMultisessionManager_FRONT +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 3bfd246dc9f534a4baea43eb10d7e0f1506d1465 diff --git a/pullgerMultisessionManager_REST b/pullgerMultisessionManager_REST deleted file mode 160000 index 64d42d0..0000000 --- a/pullgerMultisessionManager_REST +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 64d42d038075a64705801563130f4524c6471e7f diff --git a/pullgerReflection/__pycache__/__init__.cpython-38.pyc b/pullgerReflection/__pycache__/__init__.cpython-38.pyc new file mode 100644 index 0000000..ed9acb9 Binary files /dev/null and b/pullgerReflection/__pycache__/__init__.cpython-38.pyc differ diff --git a/pullgerReflection/com_linkedin b/pullgerReflection/com_linkedin index 5205320..1e27ab3 160000 --- a/pullgerReflection/com_linkedin +++ b/pullgerReflection/com_linkedin @@ -1 +1 @@ -Subproject commit 520532079c44c7afd9b0e6e945c0692eb2d6c75d +Subproject commit 1e27ab3704e5dd4f29f31564b682b57b0dd8ed8c diff --git a/pullgerReflection/com_linkedin__REST b/pullgerReflection/com_linkedin__REST new file mode 160000 index 0000000..2f75a19 --- /dev/null +++ b/pullgerReflection/com_linkedin__REST @@ -0,0 +1 @@ +Subproject commit 2f75a195d883629ca43ce8b8a2a7e1e537c8eb8c diff --git a/pullgerReflection/com_linkedin__TT b/pullgerReflection/com_linkedin__TT index 4ce0ea7..8791d7b 160000 --- a/pullgerReflection/com_linkedin__TT +++ b/pullgerReflection/com_linkedin__TT @@ -1 +1 @@ -Subproject commit 4ce0ea789873a9635d6b419d6ec0f30bd0aa3deb +Subproject commit 8791d7b3f9c523699222129e0a138f64754fa546 diff --git a/pullgerSquirrel b/pullgerSquirrel index 588b8bf..836b620 160000 --- a/pullgerSquirrel +++ b/pullgerSquirrel @@ -1 +1 @@ -Subproject commit 588b8bf9790e4887758437884b5c477a8f52cd52 +Subproject commit 836b6203d30661c0f3b4be28f3ee7514dd3754a5 diff --git a/requirements.txt b/requirements.txt index 354f0b0..3402b02 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,28 +1,11 @@ -asgiref==3.5.2 -async-generator==1.10 -attrs==21.4.0 -backports.zoneinfo==0.2.1 -certifi==2022.6.15 -cffi==1.15.1 -charset-normalizer==2.1.0 -cryptography==37.0.4 Django==4.0.6 djangorestframework==3.13.1 -h11==0.13.0 -idna==3.3 -outcome==1.2.0 -pycparser==2.21 -pyOpenSSL==22.0.0 -PySocks==1.7.1 -pytz==2022.1 -requests==2.28.1 +djangorestframework-jsonapi==5.0.0 selenium==4.3.0 -sniffio==1.2.0 sortedcontainers==2.4.0 -sqlparse==0.4.2 -trio==0.21.0 -trio-websocket==0.9.2 undetected-chromedriver==3.1.5.post4 -urllib3==1.26.11 websockets==10.3 -wsproto==1.1.0 +django-cors-headers==3.13.0 + +requests~=2.28.1 +cryptography~=37.0.4 \ No newline at end of file diff --git a/run_docker_test.sh b/run_docker_test.sh new file mode 100644 index 0000000..f957876 --- /dev/null +++ b/run_docker_test.sh @@ -0,0 +1,3 @@ +docker build -t linkedin_test -f Dockerfile.test . + +docker run --rm -t -i -p 8000:8000 linkedin_test diff --git a/test_script.sh b/test_script.sh new file mode 100644 index 0000000..a8f5990 --- /dev/null +++ b/test_script.sh @@ -0,0 +1,4 @@ +# MultiSession REST on google page +python manage.py test pullgerMultiSessionManager__REST.tests.integration.operation_elements + +python manage.py test pullgerReflection.com_linkedin.tests.end_to_end