Package: ergani
Ergani Python SDKerganiis a Python SDK for interacting with the API ofErgani.RequirementsPython 3.10 or laterInstallationTheerganipackage is available on PyPI and you can install it through your favorite package manager:pipinstallerganiUsageCreate a clientTo create a new Ergani client you have to set your Ergani username, password and optionally the Ergani API base URL, that defaults tohttps://trialeservices.yeka.gr/WebServicesAPI/api.importosfromergani.clientimportErganiClientERGANI_USERNAME=os.environ.get("ERGANI_USERNAME","")ERGANI_PASSWORD=os.environ.get("ERGANI_PASSWORD","")ERGANI_BASE_URL=os.environ.get("ERGANI_BASE_URL","")ergani_client=ErganiClient(ERGANI_USERNAME,ERGANI_PASSWORD)If you intend to use this package for multiple company entities, it is necessary to create separate client instances for each entity with the appropriate credentials.We are going to use the aforementionedergani_clientfor the following usage examples.Work cardSubmit work card records to Ergani in order to declare an employee's movement (arrival, departure).defsubmit_work_card(company_work_cards:List[CompanyWorkCard])->(Response|None)Examplefromdatetimeimportdatetime,timedeltafromergani.modelsimportCompanyWorkCard,WorkCardtoday=datetime.today()yesterday=today-timedelta(days=1)work_card_1=WorkCard(employee_tax_identification_number="123456789",employee_first_name="first_name",employee_last_name="last_name",work_card_movement_type="ARRIVAL",work_card_submission_date=today.date(),work_card_movement_datetime=today,)work_card_2=WorkCard(employee_tax_identification_number="123456789",employee_first_name="first_name",employee_last_name="last_name",work_card_movement_type="ARRIVAL",work_card_submission_date=today.date(),work_card_movement_datetime=today,)company_work_card_1=CompanyWorkCard(employer_tax_identification_number="123456789",business_branch_number=1,card_details=[work_card_1,work_card_2],)work_card_3=WorkCard(employee_tax_identification_number="123456789",employee_first_name="first_name",employee_last_name="last_name",work_card_movement_type="ARRIVAL",work_card_submission_date=today.date(),work_card_movement_datetime=yesterday,late_declaration_justification="POWER_OUTAGE",)company_work_card_2=CompanyWorkCard(employer_tax_identification_number="123456789",business_branch_number=2,card_details=[work_card_3],)company_work_cards=[company_work_card_1,company_work_card_2]response=ergani_client.submit_work_card(company_work_cards=company_work_cards)Note:You can submit work cards for various employees across multiple company branches simultaneously as shown above.OvertimeSubmit overtime records to Ergani in order to declare employees overtimes.defsubmit_overtime(company_overtimes:List[CompanyOvertime])->(Response|None)Examplefromdatimeimportdatetimefromergani.modelsimportCompanyOvertime,Overtimetoday=datetime.today()overtime=Overtime(employee_tax_identification_number="123456789",employee_social_security_number="123456789",employee_first_name="first_name",employee_last_name="last_name",overtime_date=today.date(),overtime_start_time=time(hour=18),overtime_end_time=time(hour=20),overtime_cancellation=False,employee_profession_code="123456",overtime_justification="EXCEPTIONAL_WORKLOAD",weekly_workdays_number=5,)company_overtime=CompanyOvertime(business_branch_number=1,sepe_service_code="12345",business_primary_activity_code="1234",business_branch_activity_code="1234",kallikratis_municipal_code="12345678",legal_representative_tax_identification_number="123456789",employee_overtimes=[overtime],)company_overtimes=[company_overtime]response=ergani_client.submit_overtime(company_overtimes=company_overtimes)Note:You can submit overtime records for various employees across multiple company branches simultaneously.Daily scheduleSubmit daily schedules to Ergani in order to declare schedules for employees that don't have a fixed schedule (e.g. shift workers).defsubmit_daily_schedule(company_daily_schedules:List[CompanyDailySchedule])->(Response|None)Examplefromdatimeimportdatetime,timedeltafromergani.modelsimportCompanyDailySchedule,EmployeeDailySchedule,WorkdayDetailstoday=datetime.today()tomorrow=today+timedelta(days=1)workday_details=WorkdayDetails(work_type="WORK_FROM_HOME",start_time=time(hour=9),end_time=time(hour=17))employee_daily_schedule=EmployeeDailySchedule(employee_tax_identification_number="123456789",employee_first_name="first_name",employee_last_name="last_name",schedule_date=tomorrow.date(),workday_details=[workday_details],)company_daily_schedule=CompanyDailySchedule(business_branch_number=1,employee_schedules=[employee_daily_schedule])company_daily_schedules=[company_daily_schedule]response=ergani_client.submit_daily_schedule(company_daily_schedules=company_daily_schedules)Weekly scheduleSubmit weekly schedules to Ergani in order to declare schedules for employees that have a fixed schedule.defsubmit_weekly_schedule(company_weekly_schedules:List[CompanyWeeklySchedule])->(Response|None)Examplefromdatimeimportdatetime,timedeltafromergani.modelsimportCompanyDailySchedule,EmployeeDailySchedule,WorkdayDetailstoday=datetime.today()days_until_next_monday=(0-today.weekday()+7)%7next_week_monday=today+timedelta(days=days_until_next_monday)next_week_start=next_week_monday.replace(hour=0,minute=0,second=0,microsecond=0)next_week_end=next_week_start+timedelta(days=5)workday_details=WorkdayDetails(work_type="WORK_FROM_HOME",start_time=time(hour=9),end_time=time(hour=17))employee_weekly_schedule=[]foriinrange(5):# 5 days in a work week (Monday to Friday)current_day=next_week_start+timedelta(days=i)schedule=EmployeeWeeklySchedule(employee_tax_identification_number="123456789",employee_first_name="first_name",employee_last_name="last_name",schedule_date=current_day.date(),workday_details=[workday_details],)employee_weekly_schedule.append(schedule)company_weekly_schedule=CompanyWeeklySchedule(business_branch_number=1,employee_schedules=[employee_weekly_schedule],start_date=next_week_start,end_date=next_week_end,)company_weekly_schedules=[company_weekly_schedule]response=ergani_client.submit_weekly_schedule(company_weekly_schedules=company_weekly_schedules)Note:You can submit weekly schedules for various employees across multiple company branches simultaneously.Full reference documentation is available athttps://ergani.withlogic.dev/.GlossaryThe glossary might help you if you're taking a look at the official documentation of the Ergani API (https://eservices.yeka.gr/(S(ayldvlj35eukgvmzrr055oe5))/Announcements.aspx?id=257).Work cardOriginalOriginal help text(in Greek)Translatedf_afm_ergodotiΑ.Φ.Μ Εργοδότη (Για επαλήθευση)employer_tax_identification_numberf_aaΑ/Α Παραρτήματοςbusiness_branch_numberf_commentsΣΧΟΛΙΑcommentsf_afmΑΡΙΘΜΟΣ ΦΟΡΟΛΟΓΙΚΟΥ ΜΗΤΡΩΟΥ (Α.Φ.Μ.)employee_tax_indentification_numberf_eponymoΕΠΩΝΥΜΟemployee_last_namef_onomaΟΝΟΜΑemployee_first_namef_typeΤύπος Κίνησηςwork_card_movement_typef_reference_dateΗΜ/ΝΙΑ Αναφοράςwork_card_submission_datef_dateΗΜ/ΝΙΑ Κίνησηςwork_card_movement_datetimef_aitiologiaΚΩΔΙΚΟΣ ΑΙΤΙΟΛΟΓΙΑΣ (Σε περίπτωση Εκπρόθεσμου)late_declaration_justificationWork card movement typesOriginal API codeOriginal help text(in Greek)Translated0ΠΡΟΣΕΛΕΥΣΗARRIVAL1ΑΠΟΧΩΡΗΣΗDEPARTUREWork card justificationsOriginal API codeOriginal help text(in Greek)Translated001ΠΡΟΒΛΗΜΑ ΣΤΗΝ ΗΛΕΚΤΡΟΔΟΤΗΣΗ/ΤΗΛΕΠΙΚΟΙΝΩΝΙΕΣPOWER_OUTAGE002ΠΡΟΒΛΗΜΑ ΣΤΑ ΣΥΣΤΗΜΑΤΑ ΤΟΥ ΕΡΓΟΔΟΤΗEMPLOYER_SYSTEMS_UNAVAILABLE003ΠΡΟΒΛΗΜΑ ΣΥΝΔΕΣΗΣ ΜΕ ΤΟ ΠΣ ΕΡΓΑΝΗERGANI_SYSTEMS_UNAVAILABLEOvertimeOriginalOriginal help text(in Greek)Translatedf_aaΑ/Α Παραρτήματοςbusiness_branch_numberf_rel_protocolΣΧΕΤΙΚΟ ΕΝΤΥΠΟ ΑΡΙΘ. ΠΡΩΤ.related_protocol_idf_rel_dateΣΧΕΤΙΚΟ ΕΝΤΥΠΟ ΗΜΕΡΟΜΗΝΙΑrelated_protocol_datef_ypiresia_sepeΚΩΔΙΚΟΣ ΥΠΗΡΕΣΙΑΣ ΣΕΠΕsepe_service_codef_ergodotikh_organwshΕΡΓΟΔΟΤΙΚΗ ΟΡΓΑΝΩΣΗemployer_organizationf_kad_kyriaΚ.Α.Δ. - ΚΥΡΙΑ ΔΡΑΣΤΗΡΙΟΤΗΤΑbusiness_primary_activity_codef_kad_deyt_1Κ.Α.Δ. - ΚΥΡΙΑ ΔΡΑΣΤΗΡΙΟΤΗΤΑ	1business_secondary_activity_code_1f_kad_deyt_2Κ.Α.Δ. - ΚΥΡΙΑ ΔΡΑΣΤΗΡΙΟΤΗΤΑ	2business_secondary_activity_code_2f_kad_deyt_3Κ.Α.Δ. - ΚΥΡΙΑ ΔΡΑΣΤΗΡΙΟΤΗΤΑ	3business_secondary_activity_code_3f_kad_deyt_4Κ.Α.Δ. - ΚΥΡΙΑ ΔΡΑΣΤΗΡΙΟΤΗΤΑ	4business_secondary_activity_code_4f_kad_pararthmatosΚ.Α.Δ. ΠΑΡΑΡΤΗΜΑΤΟΣbusiness_brach_activity_codef_kallikratis_pararthmatosΔΗΜΟΤΙΚΗ / ΤΟΠΙΚΗ ΚΟΙΝΟΤΗΤΑkallikratis_municipal_codef_commentsΠΑΡΑΤΗΡΗΣΕΙΣcommentsf_afm_proswpoyΝόμιμος Εκπρόσωπος(Α.Φ.Μ.)legal_representative_tax_identification_numberf_afmΑΡΙΘΜΟΣ ΦΟΡΟΛΟΓΙΚΟΥ ΜΗΤΡΩΟΥ (Α.Φ.Μ.)employee_tax_indentification_numberf_amkaΑΡΙΘΜΟΣ ΜΗΤΡΩΟΥ ΚΟΙΝΩΝΙΚΗΣ ΑΣΦΑΛΙΣΗΣ (Α.Μ.Κ.Α.)employee_social_security_numberf_eponymoΕΠΩΝΥΜΟemployee_last_namef_onomaΟΝΟΜΑemployee_first_namef_dateΗΜΕΡΟΜΗΝΙΑ ΥΠΕΡΩΡΙΑΣovertime_datef_fromΩΡΑ ΕΝΑΡΞΗΣ ΥΠΕΡΩΡΙΑΣ (HH24:MM)overtime_start_timef_toΩΡΑ ΛΗΞΗΣ ΥΠΕΡΩΡΙΑΣ (HH24:MM)overtime_end_timef_cancellationΑΚΥΡΩΣΗ ΥΠΕΡΩΡΙΑΣovertime_cancellationf_stepΕΙΔΙΚΟΤΗΤΑ ΚΩΔΙΚΟΣemployee_profession_codef_reasonΑΙΤΙΟΛΟΓΙΑ ΚΩΔΙΚΟΣovertime_justificationf_weekdatesΕΒΔΟΜΑΔΙΑΙΑ ΑΠΑΣΧΟΛΗΣΗ (5) ΠΕΝΘΗΜΕΡΟ (6) ΕΞΑΗΜΕΡΟweekly_workdays_numberf_aseeΕΓΚΡΙΣΗ ΑΣΕΕasee_approvalOvertime justficationsOriginal API codeOriginal help text(in Greek)Translation001ΠΡΟΛΗΨΗ ΑΤΥΧΗΜΑΤΩΝ Η ΑΠΟΚΑΤΑΣΤΑΣΗ ΖΗΜΙΩΝACCIDENT_PREVENTION_OR_DAMAGE_RESTORATION002ΕΠΕΙΓΟΥΣΕΣ ΕΡΓΑΣΙΕΣ ΕΠΟΧΙΑΚΟΥ ΧΑΡΑΚΤΗΡΑURGENT_SEASONAL_TASKS003ΕΞΑΙΡΕΤΙΚΗ ΣΩΡΕΥΣΗ ΕΡΓΑΣΙΑΣ – ΦΟΡΤΟΣ ΕΡΓΑΣΙΑΣEXCEPTIONAL_WORKLOAD004ΠΡΟΕΠΙΣΚΕΥΑΣΤΙΚΕΣ Η ΣΥΜΠΛΗΡΩΜΑΤΙΚΕΣ ΕΡΓΑΣΙΕΣSUPPLEMENTARY_TASKS005ΑΝΑΠΛΗΡΩΣΗ ΧΑΜΕΝΩΝ ΩΡΩΝ ΛΟΓΩ ΞΑΦΝΙΚΩΝ ΑΙΤΙΩΝ Η ΑΝΩΤΕΡΑΣ ΒΙΑΣLOST_HOURS_SUDDEN_CAUSES006ΑΝΑΠΛΗΡΩΣΗ ΧΑΜΕΝΩΝ ΩΡΩΝ ΛΟΓΩ ΕΠΙΣΗΜΩΝ ΑΡΓΙΩΝLOST_HOURS_OFFICIAL_HOLIDAYS007ΑΝΑΠΛΗΡΩΣΗ ΧΑΜΕΝΩΝ ΩΡΩΝ ΛΟΓΩ ΚΑΙΡΙΚΩΝ ΣΥΝΘΗΚΩΝLOST_HOURS_WEATHER_CONDITIONS008ΈΚΤΑΚΤΕΣ ΕΡΓΑΣΙΕΣ ΚΛΕΙΣΙΜΑΤΟΣ ΗΜΕΡΑΣ Η ΜΗΝΑEMERGENCY_CLOSURE_DAY009ΛΟΙΠΕΣ ΕΡΓΑΣΙΕΣ ΟΙ ΟΠΟΙΕΣ ΔΕΝ ΜΠΟΡΟΥΝ ΝΑ ΠΡΑΓΜΑΤΟΠΟΙΗΘΟΥΝ ΚΑΤΑ ΤΙΣ ΕΡΓΑΣΙΜΕΣ ΩΡΕΣNON_WORKDAY_TASKSDaily scheduleOriginalOriginal help text(in Greek)Translatedf_aa_pararthmatosΑ/Α ΠΑΡΑΡΤΗΜΑΤΟΣbusiness_branch_numberf_rel_protocolΣΧΕΤΙΚΟ ΕΝΤΥΠΟ ΑΡΙΘ. ΠΡΩΤ.related_protocol_idf_rel_dateΣΧΕΤΙΚΟ ΕΝΤΥΠΟ ΗΜΕΡΟΜΗΝΙΑrelated_protocol_datef_commentsΠΑΡΑΤΗΡΗΣΕΙΣcommentsf_from_dateΗΜΕΡΟΜΗΝΙΑ ΑΠΟstart_datef_to_dateΗΜΕΡΟΜΗΝΙΑ ΕΩΣend_datef_afmΑΡΙΘΜΟΣ ΦΟΡΟΛΟΓΙΚΟΥ ΜΗΤΡΩΟΥ (Α.Φ.Μ.)employee_tax_indentification_numberf_eponymoΕΠΩΝΥΜΟemployee_last_namef_onomaΟΝΟΜΑemployee_first_namef_dayΗΜΕΡΑschedule_datef_typeΤΥΠΟΣ ΑΝΑΛΥΤΙΚΗΣ ΕΓΓΡΑΦΗΣ - ΚΩΔΙΚΟΣwork_typef_fromΩΡΑ ΑΠΟ (HH24:MM)start_timef_toΩΡΑ ΕΩΣ (HH24:MM)end_timeWeekly scheduleOriginalOriginal help text(in Greek)Translatedf_aa_pararthmatosΑ/Α ΠΑΡΑΡΤΗΜΑΤΟΣbusiness_brach_numberf_rel_protocolΣΧΕΤΙΚΟ ΕΝΤΥΠΟ ΑΡΙΘ. ΠΡΩΤ.related_protocol_idf_rel_dateΣΧΕΤΙΚΟ ΕΝΤΥΠΟ ΗΜΕΡΟΜΗΝΙΑrelated_protocol_datef_commentsΠΑΡΑΤΗΡΗΣΕΙΣcommentsf_from_dateΗΜΕΡΟΜΗΝΙΑ ΑΠΟstart_datef_to_dateΗΜΕΡΟΜΗΝΙΑ ΕΩΣend_datef_afmΑΡΙΘΜΟΣ ΦΟΡΟΛΟΓΙΚΟΥ ΜΗΤΡΩΟΥ (Α.Φ.Μ.)employee_tax_indentification_numberf_eponymoΕΠΩΝΥΜΟemployee_last_namef_onomaΟΝΟΜΑemployee_first_namef_dateΗΜΕΡΟΜΗΝΙΑschedule_datef_typeΤΥΠΟΣ ΑΝΑΛΥΤΙΚΗΣ ΕΓΓΡΑΦΗΣ - ΚΩΔΙΚΟΣwork_typef_fromΩΡΑ ΑΠΟ (HH24:MM)start_timef_toΩΡΑ ΕΩΣ (HH24:MM)end_timeSchedule work typesOriginal API codeOriginal help text(in Greek)TranslatedΜΕΜΗ ΕΡΓΑΣΙΑABSENTΑΝΑΝΑΠΑΥΣΗ/ΡΕΠΟREST_DAYΤΗΛΤΗΛΕΡΓΑΣΙΑWORK_FROM_HOMEΕΡΓΕΡΓΑΣΙΑWORK_FROM_OFFICELicenseThis project is licensed under theMIT License🦄 Built withLOGIC. 🦄