Code Duplication    Length = 18-19 lines in 3 locations

Python/orthanc/query.py 3 locations

@@ 30-48 (lines=19) @@
27
28
        return r.status_code, r.json()
29
30
def postOrthanc(endpoint, data):
31
    """
32
    Get from a Orthanc endpoint
33
    :param endpoint:
34
    :return: bool on if such PSCID (INSTITUTIONID + PROJECTID + SUBJECTID) exist already.
35
    """
36
    logger = logging.getLogger('Orthanc_post')
37
    logger.info("Post Orthanc endpoint: "+ endpoint + "at")
38
    load_dotenv()
39
    url = os.getenv("OrthancURL")
40
    updatedurl = url + endpoint
41
    logger.info(updatedurl)
42
43
    with requests.Session() as s:
44
        r = s.post(updatedurl, files=data)
45
46
        logger.info("Post Result:" + str(r.status_code) + r.reason)
47
48
        return r.status_code, r
49
50
51
def deleteOrthanc(endpoint):
@@ 51-68 (lines=18) @@
48
        return r.status_code, r
49
50
51
def deleteOrthanc(endpoint):
52
    """
53
    Delete from a Orthanc endpoint
54
    :param endpoint:
55
    :return: bool on if such PSCID (INSTITUTIONID + PROJECTID + SUBJECTID) exist already.
56
    """
57
    logger = logging.getLogger('Orthanc_delete')
58
    logger.info("Deleting Orthanc endpoint: "+ endpoint + "at")
59
    load_dotenv()
60
    url = os.getenv("OrthancURL")
61
    updatedurl = url + endpoint
62
    logger.info(updatedurl)
63
64
    with requests.Session() as s:
65
        r = s.delete(updatedurl)
66
        logger.info("Deletion Result:" + str(r.status_code) + r.reason)
67
68
        return r.status_code, r.json()
69
70
"""
71
def zipOrthanc(endpoint):
@@ 11-28 (lines=18) @@
8
logger = logging.getLogger('Orthanc Query:')
9
10
11
def getOrthanc(endpoint):
12
    """
13
    Get from a Orthanc endpoint
14
    :param endpoint:
15
    :return: bool on if such PSCID (INSTITUTIONID + PROJECTID + SUBJECTID) exist already.
16
    """
17
    logger = logging.getLogger('Orthanc_get')
18
    logger.info("Getting Orthanc endpoint: "+ endpoint + "at")
19
    load_dotenv()
20
    url = os.getenv("OrthancURL")
21
    updatedurl = url + endpoint
22
    logger.info(updatedurl)
23
24
    with requests.Session() as s:
25
        r = s.get(updatedurl)
26
        logger.info("Get Result:" + str(r.status_code) + r.reason)
27
28
        return r.status_code, r.json()
29
30
def postOrthanc(endpoint, data):
31
    """