Ejemplo n.º 1
0
    def __get_request(self, object_type, object_oid):
        url = self.url + object_type + '/' + object_oid
        request = methods.Method(url, self.connection['credentials'],
                                 methods.Type.GET)
        response = request.execute()

        # Prase response and return
        return xml_parser.Parser(response.content).metadata
Ejemplo n.º 2
0
 def __modify_request(self, object_type, object_oid, modification):
     url = self.url + object_type + '/' + object_oid
     request = methods.Method(
         url,
         self.connection['credentials'],
         methods.Type.POST,
         payload=self.__craft_modification(modification))
     response = request.execute()
     return response
Ejemplo n.º 3
0
 def __create_request(self, object_type, name, metadata):
     url = self.url + object_type
     metadata['name'] = name
     request = methods.Method(url,
                              self.connection['credentials'],
                              methods.Type.POST,
                              payload=self.__craft_create(
                                  object_type, metadata))
     response = request.execute()
     return response.headers['location'].split('/')[-1]
Ejemplo n.º 4
0
 def __search_request(self, object_type, search_filter):
     # Make request
     url = self.url + object_type + '/search'
     request = methods.Method(
         url,
         self.connection['credentials'],
         methods.Type.POST,
         payload=(self.__craft_search_filter(search_filter)))
     response = request.execute()
     data = xml_parser.Parser(response.content).metadata
     if data:
         ## This is particular to midPoint as it returns multiple results with the top-level tag as object
         data = data['object']
     elif not len(data):
         data = []
     if isinstance(data, dict):
         data = [data]
     # Prase response  and return
     return data
Ejemplo n.º 5
0
import tkinter as tk
from tkinter.filedialog import askopenfilename

import methods as mt  #class Method():

import os

g_methods = [
    #
    # ADD YOUR METHODS HERE, add comma afterwards
    #
    mt.Method('Ceasar', mt.enCeasar, mt.deCeasar),
    mt.Method('Rot10', mt.enRot, mt.deRot)
]
"""
The Main application class of the
    encoder decoder program
Args:
    tk.Frame: the superclass this class inherits from
"""


class MainApplication(tk.Frame):
    """
    Creates the Methods list when running the program. If you
        wish to add your own encode/decode method, do it here.
        Simply add a new method using similar code below
    Args:
        self: the mainApplication calling this function

    """