feat: create config class to replace use of config file in application
This commit is contained in:
@@ -2,12 +2,11 @@ import sqlite3
|
||||
|
||||
from PyQt6.QtCore import QThread
|
||||
from PyQt6.QtCore import pyqtSignal as Signal
|
||||
from omegaconf import OmegaConf
|
||||
from src.backend.database import Database
|
||||
from src.logic.log import MyLogger
|
||||
from src.logic.webrequest import BibTextTransformer, WebRequest
|
||||
|
||||
config = OmegaConf.load("config.yaml")
|
||||
|
||||
|
||||
|
||||
class BookGrabber(QThread):
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import requests
|
||||
from bs4 import BeautifulSoup
|
||||
from omegaconf import OmegaConf
|
||||
|
||||
# import sleep_and_retry decorator to retry requests
|
||||
from ratelimit import limits, sleep_and_retry
|
||||
@@ -10,7 +9,6 @@ from src.logic.log import MyLogger
|
||||
from src.transformers import ARRAYData, BibTeXData, COinSData, RDSData, RISData
|
||||
|
||||
logger = MyLogger(__name__)
|
||||
config = OmegaConf.load("config.yaml")
|
||||
|
||||
API_URL = "https://rds.ibs-bw.de/phfreiburg/opac/RDSIndexrecord/{}/"
|
||||
PPN_URL = "https://rds.ibs-bw.de/phfreiburg/opac/RDSIndex/Search?type0%5B%5D=allfields&lookfor0%5B%5D=&join=AND&bool0%5B%5D=AND&type0%5B%5D=au&lookfor0%5B%5D=&join=AND&bool0%5B%5D=AND&type0%5B%5D=ti&lookfor0%5B%5D=&join=AND&bool0%5B%5D=AND&type0%5B%5D=ct&lookfor0%5B%5D=&join=AND&bool0%5B%5D=AND&type0%5B%5D=isn&lookfor0%5B%5D=&join=AND&bool0%5B%5D=AND&type0%5B%5D=ta&lookfor0%5B%5D=&join=AND&bool0%5B%5D=AND&type0%5B%5D=co&lookfor0%5B%5D=&join=AND&bool0%5B%5D=AND&type0%5B%5D=py&lookfor0%5B%5D=&join=AND&bool0%5B%5D=AND&type0%5B%5D=pp&lookfor0%5B%5D=&join=AND&bool0%5B%5D=AND&type0%5B%5D=pu&lookfor0%5B%5D=&join=AND&bool0%5B%5D=AND&type0%5B%5D=si&lookfor0%5B%5D={}&join=AND&bool0%5B%5D=AND&type0%5B%5D=zr&lookfor0%5B%5D=&join=AND&bool0%5B%5D=AND&type0%5B%5D=cc&lookfor0%5B%5D=&join=AND&bool0%5B%5D=AND"
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
from pyzotero import zotero
|
||||
from dataclasses import dataclass
|
||||
from src.logic.webrequest import WebRequest, BibTextTransformer
|
||||
from omegaconf import OmegaConf
|
||||
from src import settings
|
||||
|
||||
config = OmegaConf.load("config.yaml")
|
||||
config = config["zotero"]
|
||||
|
||||
|
||||
@dataclass
|
||||
@@ -160,9 +158,12 @@ class JournalArticle:
|
||||
|
||||
|
||||
class ZoteroController:
|
||||
zoterocfg = settings.zotero
|
||||
def __init__(self):
|
||||
self.zot = zotero.Zotero(
|
||||
config["library_id"], config["library_type"], config["api_key"]
|
||||
self.zoterocfg.library_id,
|
||||
self.zoterocfg.library_type,
|
||||
self.zoterocfg.api_key,
|
||||
)
|
||||
|
||||
def get_books(self):
|
||||
|
||||
Reference in New Issue
Block a user