Skip to content

Commit

Permalink
Fix: the api url
Browse files Browse the repository at this point in the history
  • Loading branch information
cihanandac committed Jul 4, 2024
1 parent 3a24db4 commit 647dc93
Showing 1 changed file with 21 additions and 28 deletions.
49 changes: 21 additions & 28 deletions backend/src/bonnefanten/src/bonnefanten/browser/admin.py
Original file line number Diff line number Diff line change
@@ -1,44 +1,37 @@
from bonnefanten.config import DATA_REPO
from bonnefanten.config import IMAGE_BASE_URL
from bonnefanten.config import IMPORT_LOCATIONS
import base64
import json
import logging
import os
import re
import time
import uuid
import xml.etree.ElementTree as ET
from collections import defaultdict
from datetime import datetime
from xml.dom import minidom
from xml.etree.ElementTree import Element, SubElement, tostring

import lxml.etree
import requests
import transaction
from bonnefanten.config import DATA_REPO, IMAGE_BASE_URL, IMPORT_LOCATIONS
from DateTime import DateTime
from plone import api
from plone.api import content
from plone.api import portal
from plone.api import relation
from plone.app.multilingual.api import get_translation_manager
from plone.app.multilingual.api import translate
from plone.api import content, portal, relation
from plone.app.multilingual.api import get_translation_manager, translate
from plone.app.multilingual.interfaces import ITranslationManager
from plone.dexterity.interfaces import IDexterityContent
from plone.folder.interfaces import IExplicitOrdering
from plone.namedfile.file import NamedBlobImage
from plone.protect.interfaces import IDisableCSRFProtection
from Products.Five.browser import BrowserView
from xml.dom import minidom
from xml.etree.ElementTree import Element
from xml.etree.ElementTree import SubElement
from xml.etree.ElementTree import tostring
from zc.relation.interfaces import ICatalog
from zope import component
from zope.component import getUtility
from zope.interface import alsoProvides
from zope.intid.interfaces import IIntIds
from zope.schema import getFields

import base64
import json
import logging
import lxml.etree
import os
import re
import requests
import time
import transaction
import uuid
import xml.etree.ElementTree as ET


class AdminFixes(BrowserView):
def __call__(self):
Expand Down Expand Up @@ -141,7 +134,7 @@ def import_objects(self, top_limit="0"):
# start_range = self.request.form.get("start_range", 0)
# end_range = self.request.form.get("end_range", 3000)
object_id = self.request.form.get("object_id")
limit = self.request.form.get("limit", "1000")
limit = self.request.form.get("limit", "100")
offset = self.request.form.get("offset", "0")
if top_limit != "0":
offset = str(top_limit)
Expand Down Expand Up @@ -174,7 +167,7 @@ def import_objects(self, top_limit="0"):
"Authorization": f"Basic {encoded_credentials}",
}

api_url = "https://de1.zetcom-group.de/MpWeb-mpMaastrichtBonnefanten/ria-ws/application/module/Object/export/61002/"
api_url = "https://mpmaastrichtbonnefanten.zetcom.app/ria-ws/application/module/Object/export/61002/"

# Get the directory of the current script
current_directory = os.path.dirname(os.path.abspath(__file__))
Expand Down Expand Up @@ -265,7 +258,7 @@ def import_objects(self, top_limit="0"):
def serial_import(self):
start_value = self.request.form.get("start_value", "4000")
top_limit = self.request.form.get("top_limit", "0")
for offset in range(int(start_value), int(top_limit), 1000):
for offset in range(int(start_value), int(top_limit), 100):
self.import_objects(top_limit=offset)


Expand Down Expand Up @@ -672,7 +665,7 @@ def import_images(container, object_id, headers):
# print("Failed to extract image data.")

try:
image_url = f"https://de1.zetcom-group.de/MpWeb-mpMaastrichtBonnefanten/ria-ws/application/module/Object/{object_id}/attachment"
image_url = f"https://mpmaastrichtbonnefanten.zetcom.app/ria-ws/application/module/Object/{object_id}/attachment"

with requests.get(url=image_url, headers=headers) as req:
req.raise_for_status()
Expand Down

0 comments on commit 647dc93

Please sign in to comment.