Current state from production
This commit is contained in:
parent
10e8feabfd
commit
77ae54f381
4 changed files with 46 additions and 11 deletions
|
@ -82,7 +82,7 @@ class Adonis:
|
|||
"Pin": pin
|
||||
}
|
||||
|
||||
result = self.requestCrewPortal("DG_PersonalInformationRead", data)
|
||||
result = self.requestCrewPortal("DG_GeneralDetailsRead", data)
|
||||
|
||||
return result
|
||||
|
||||
|
@ -91,13 +91,13 @@ class Adonis:
|
|||
"Pin": pin
|
||||
}
|
||||
|
||||
result = self.requestCrewPortal("DG_ProfilePictureRead", data)
|
||||
|
||||
try:
|
||||
return result["FileBase64"]
|
||||
result = self.requestCrewPortal("DG_ProfilePictureRead", data)
|
||||
except AdonisError:
|
||||
return None
|
||||
|
||||
return result["FileBase64"]
|
||||
|
||||
def getCrew(self, pin, personal_data=True, profile_picture=True):
|
||||
crew = Crew(pin)
|
||||
|
||||
|
@ -109,5 +109,35 @@ class Adonis:
|
|||
|
||||
return crew
|
||||
|
||||
def getRequirements():
|
||||
pass
|
||||
def getCrewListView(self, view, filters="", pagination="", paginate_by="", page=""):
|
||||
data = {
|
||||
"View": view,
|
||||
"Filter": filters,
|
||||
"Ragination": pagination or "None",
|
||||
"RowsByPage": paginate_by,
|
||||
"Page": page
|
||||
}
|
||||
|
||||
try:
|
||||
result = self.requestIntegration("GNL_APMCrewListViews", data)
|
||||
except AdonisError:
|
||||
result = None
|
||||
|
||||
return result
|
||||
|
||||
def getRequirements(self, view):
|
||||
requirements = []
|
||||
pnum = 1
|
||||
|
||||
while True:
|
||||
page = self.getCrewListView(view, pagination="True", paginate_by="100", page=str(pnum))
|
||||
|
||||
for record in json.loads(page["Result"]):
|
||||
requirements.append((record["PIN"], record["Document code"]))
|
||||
|
||||
if page["CurrentPage"] == page["TotalPages"]:
|
||||
break
|
||||
|
||||
pnum += 1
|
||||
|
||||
return requirements
|
|
@ -6,19 +6,23 @@ class Crew:
|
|||
|
||||
@property
|
||||
def firstName(self):
|
||||
return self._personal_data["DetailsAll"]["Details"]["FirstName"]
|
||||
return self._personal_data["Details"]["FirstName"]
|
||||
|
||||
@property
|
||||
def middleName(self):
|
||||
return self._personal_data["DetailsAll"]["Details"]["MiddleName"]
|
||||
return self._personal_data["Details"]["MiddleName"]
|
||||
|
||||
@property
|
||||
def lastName(self):
|
||||
return self._personal_data["DetailsAll"]["Details"]["LastName"]
|
||||
return self._personal_data["Details"]["LastName"]
|
||||
|
||||
@property
|
||||
def birthDate(self):
|
||||
return self._personal_data["DetailsAll"]["Details"]["BirthDate"]
|
||||
return self._personal_data["Details"]["BirthDate"]
|
||||
|
||||
@property
|
||||
def email(self):
|
||||
return self._personal_data["Emails"][0]["Email"] if self._personal_data["Emails"] else ""
|
||||
|
||||
@property
|
||||
def profilePicture(self):
|
||||
|
|
|
@ -25,6 +25,7 @@ if __name__ == "__main__":
|
|||
crewdata["lastName"] = crew.lastName
|
||||
crewdata["dob"] = crew.birthDate
|
||||
crewdata["password"] = crew.birthDate.replace("-","")
|
||||
crewdata["email"] = crew.email
|
||||
crewdata["profilePicture"] = crew.profilePicture
|
||||
|
||||
data[pin] = crewdata
|
||||
|
|
Loading…
Reference in a new issue