|
|
|
@ -16,18 +16,22 @@ def get_cafe_id(session): |
|
|
|
return cafe |
|
|
|
|
|
|
|
|
|
|
|
def get_iBOH_id(session, bearer_token): |
|
|
|
headers = {"authorization": f"Bearer {bearer_token}"} |
|
|
|
r = session.get( |
|
|
|
"https://pantry.panerabread.com/apis/pantry-ui-service/user-profile/v1/user/ibohid", |
|
|
|
headers=headers, |
|
|
|
) |
|
|
|
data = json.loads(r.text) |
|
|
|
return data["ibohid"] |
|
|
|
# def get_iBOH_id(session, bearer_token): |
|
|
|
# headers = {"authorization": f"Bearer {bearer_token}"} |
|
|
|
# r = session.get( |
|
|
|
# "https://pantry.panerabread.com/apis/pantry-ui-service/user-profile/v1/user/ibohid", |
|
|
|
# headers=headers, |
|
|
|
# ) |
|
|
|
# data = json.loads(r.text) |
|
|
|
# return data["ibohid"] |
|
|
|
def get_employee_id(session): |
|
|
|
user_data = get_signed_in_user(session) |
|
|
|
return user_data["userId"] |
|
|
|
|
|
|
|
|
|
|
|
def get_timezone(session, bearer_token, cafe_id): |
|
|
|
headers = {"authorization": f"Bearer {bearer_token}"} |
|
|
|
|
|
|
|
base_url = ( |
|
|
|
"https://pantry.panerabread.com/apis/selfservice-ui-service/v1/migration/check" |
|
|
|
) |
|
|
|
@ -40,20 +44,18 @@ def get_timezone(session, bearer_token, cafe_id): |
|
|
|
def get_shifts( |
|
|
|
session, |
|
|
|
bearer_token, |
|
|
|
iBOH_id, |
|
|
|
cafe_id, |
|
|
|
employee_id, |
|
|
|
start_date: datetime.date, |
|
|
|
end_date: datetime.date, |
|
|
|
): |
|
|
|
headers = {"authorization": f"Bearer {bearer_token}"} |
|
|
|
|
|
|
|
base_url = f"https://iportal.panerabread.com/pantry-apis/scheduling-ui-service/associate/{iBOH_id}/shifts" |
|
|
|
base_url = f"https://pantry.panerabread.com/apis/selfservice-ui-service/v1/employees/{employee_id}/self_service" |
|
|
|
# base_url = f"https://iportal.panerabread.com/pantry-apis/scheduling-ui-service/associate/{iBOH_id}/shifts" |
|
|
|
|
|
|
|
query = { |
|
|
|
"cafeNo": cafe_id, |
|
|
|
"withHistory": True, |
|
|
|
"startDate": start_date.strftime("%Y-%m-%d"), |
|
|
|
"endDate": end_date.strftime("%Y-%m-%d"), |
|
|
|
"shiftStartDate": start_date.strftime("%Y-%m-%d"), |
|
|
|
"shiftEndDate": end_date.strftime("%Y-%m-%d"), |
|
|
|
} |
|
|
|
|
|
|
|
r = session.get(base_url, params=query, headers=headers) |
|
|
|
|