示例#1
0
 def __init__(self, geni_input, type_geni="g"):  # id int or string
     '''
     The geni input provided can be:
     - The id of the profile
     - The id of the profile with g
     - Each address of the profile.
     '''
     #Some checking parameters initiated
     self.properly_executed = False
     self.existing_in_geni = False
     self.geni_specific_data = {}
     #We initiate the base classes
     geni_calls.__init__(self)
     url = process_geni_input(geni_input, type_geni) + self.token_string()
     r = s.geni_request_get(url)
     data = r.json()
     #Now we can execute the constructor
     if (not "first_name" in data.keys()):
         data["first_name"] = NOT_KNOWN_VALUE
     if (not "last_name" in data.keys()):
         data["last_name"] = NOT_KNOWN_VALUE
     gen_profile.__init__(self,
                          data["first_name"],
                          data["last_name"],
                          id_db=data.get("id", None))
     if not "error" in data.keys():
         self.existing_in_geni = True
         self.fulldata = data
         if "mugshot_urls" in data:
             data.pop("mugshot_urls")
         if "photo_urls" in data:
             data.pop("photo_urls")
         self.data = data
         self.get_geni_data(data)
         self.properly_executed = True
示例#2
0
 def __init__(self,
              geni_input,
              type_geni="g",
              data_language="en",
              data_value=None):
     '''
     The geni input provided can be:
     - The id of the profile
     - The id of the profile with g
     - Each address of the profile.
     - data_value: is the raw output from Geni API that can be used for direct data introductions
     '''
     #Some checking parameters initiated
     self.properly_executed = False
     self.existing_in_geni = False
     self.merged_in_geni = False
     self.geni_specific_data = {}
     #We initiate the base classes
     geni_calls.__init__(self)
     #It is possible to introduce the direct raw data from geni to the profile
     if data_value: data = data_value
     else:
         url = process_geni_input(geni_input,
                                  type_geni) + self.token_string()
         r = s.geni_request_get(url)
         data = r.json()
     #In case the profile has been merged to other profile, as the information is available it will be modified.
     if (data.get("merged_into", None) and data.get("deleted", None)):
         self.merged_in_geni = True
         url = data.get("merged_into") + self.token_string()
         r = s.geni_request_get(url)
         data = r.json()
     #Now we can execute the constructor
     if ("first_name" not in data.keys()):
         data["first_name"] = NOT_KNOWN_VALUE
     if ("last_name" not in data.keys()):
         data["last_name"] = data.get("maiden_name", NOT_KNOWN_VALUE)
     gen_profile.__init__(self,
                          data["first_name"],
                          data["last_name"],
                          id_db=data.get("id", None),
                          data_language="en")
     #In some cases we do not have access to the profile and data is not accurate
     if data.get("name", None):
         if ("<private>" in data["name"]): self.set_accessible(False)
     if not "error" in data.keys():
         self.existing_in_geni = True
         self.fulldata = data
         if "mugshot_urls" in data:
             data.pop("mugshot_urls")
         if "photo_urls" in data:
             data.pop("photo_urls")
         self.data = data
         self.get_geni_data(data)
         self.properly_executed = True