Pages¶
AccessRequestPage¶
-
class
autohandshake.
AccessRequestPage
(browser: autohandshake.src.HandshakeBrowser.HandshakeBrowser)¶ The page on which users view and respond to Handshake access requests.
Can only be accessed with a Career Services/admin-style account.
Parameters: browser (HandshakeBrowser) – a logged-in HandshakeBrowser -
get_request_data
(*args, **kwargs)¶ Scrape access request data from the access request page for the specified request status.
Data will be returned as a list of dicts of the form:
{ 'user': 'Alex Student', # the requesting user's name 'user_id': '1843927', # the requesting user's account ID 'email': 'student.alex@gmail.com', # the requesting user's email 'request_date': datetime.datetime(2019, 4, 12).date(), # the date the request was made 'request': 'Student Access' # the request type, one of 'Student Access', 'Student Reactivation', or 'Mentor Access'], 'status': 'waiting' # the request status, one of 'waiting', 'successful', 'rejected', or 'failed' }
IMPORTANT: due to unknown limitations of Handshake’s server, the request page appears to only be capable of loading up to around 1750 rows before crashing the website. To guard against this, this method will only pull the first 69 pages of results. If you have more than 1725 requests in any status, you will be unable to pull the entire dataset for that status. The method will only return the first 1725 rows.
Parameters: status (RequestStatus) – the status type of requests to pull. By default, pull data for all requests Returns: a list of request data dicts Return type: list
-
-
class
autohandshake.
RequestStatus
¶ The possible access request statuses:
- WAITING - requests that have not yet been processed
- SUCCESSFUL - requests that were approved
- REJECTED - requests that were rejected
- FAILED - requests that failed for other reasons
- ALL - include all request statuses
Example¶
from autohandshake import HandshakeSession, AccessRequestPage, RequestStatus
with HandshakeSession(school_url, email) as browser:
access_request_page = AccessRequestPage(browser)
rejected_requests = access_request_page.get_request_data(RequestStatus.REJECTED)
successful_requests = access_request_page.get_request_data(RequestStatus.SUCCESSFUL)
all_requests = access_request_page.get_request_data()
AppointmentCalendarPage¶
-
class
autohandshake.
AppointmentCalendarPage
(browser: autohandshake.src.HandshakeBrowser.HandshakeBrowser)¶ The calendar view of staff appointments.
Can only be accessed with a career services/admin-type account.
Parameters: browser (HandshakeBrowser) – a logged-in HandshakeBrowser -
get_unfilled_blocks
(*args, **kwargs)¶ Get a list of unfilled appointment block data for the days from start_date up to (but not including) end_date.
The method returns a list of appointment block dicts of the form:
{ 'start_time': datetime.datetime(2019, 3, 7, 9, 30), # block start time 'end_time': datetime.datetime(2019, 3, 7, 10, 30), # block end time 'length': 60, # difference in minutes between start time and end time 'status': 'unfilled', # status of the appointment 'staff_name': 'Jane Coach', # the name of the staff member associated with the block 'mediums': ['in-person', 'virtual'] # [OPTIONAL] the list of possible mediums for the open block }
Parameters: - start_date (date) – the start date of the date range from which to pull the data
- end_date (date) – the end date of the date range from which to pull the data. If no end date is specified, only pull data for start_date
- include_mediums (bool) – whether or not to include the appointment block mediums in the data. Including the medium significantly increases the time required to pull the data.
Returns: a list of appointment block dicts
Return type: list
-
go_to_date
(*args, **kwargs)¶ Using the calendar’s datepicker, navigate to the specified date
Parameters: date (date) – the date to which to navigate on the calendar
-
Example¶
from autohandshake import HandshakeSession, AppointmentCalendarPage
import datetime
with HandshakeSession(school_url, email) as browser:
calendar_page = AppointmentCalendarPage(browser)
unfilled = calendar_page.get_unfilled_blocks(start_date = datetime.datetime(2019, 4, 3).date(),
end_date = datetime.datetime(2019, 4, 10).date(),
include_mediums = True)
AppointmentTypePage¶
-
class
autohandshake.
AppointmentTypePage
(type_id: int, browser: autohandshake.src.HandshakeBrowser.HandshakeBrowser)¶ A settings page for a single appointment type.
Parameters: - type_id (int) – the id of the appointment type to load
- browser (HandshakeBrowser) – a logged-in HandshakeBrowser
-
get_settings
(*args, **kwargs)¶ Get the settings for this page’s appointment type.
The method returns a dictionary of settings values of the form:
{ 'id': 238492, 'name': 'STEM Resume Appointment', 'description': 'An appointment for STEM students who want to improve their resume.', 'length': 30, 'categories': ['Resume/Cover Letter Review'], 'drop_in_enabled': False, 'pre_message': 'Please bring your resume with you to the appointment.', 'pre_survey': None, 'post_message': 'Thank you for stopping by!', 'post_survey': 'Resume Review Satisfaction Survey', 'staff_survey': 'Main Career Center Staff Survey', 'school_years': ['Sophomore', 'Junior', 'Senior'], 'cum_gpa_required': True, 'cum_gpa': 3.0, 'major_groups': ['major_group: Computer Science', 'major_group: Chemical Engineerng', 'major_group: Biology', 'indv_major: Biological Engineering'], 'colleges': ['School of Engineering', 'School of Arts & Sciences'], 'labels': ['appointments allowed'], 'career_clusters': ['Science Careers', 'Engineering Careers'] }
Returns: a dictionary of all the appointment type settings fields Return type: dict
Example¶
from autohandshake import HandshakeSession, AppointmentTypePage
stem_appt_type_id = 21849
with HandshakeSession(school_url, email) as browser:
type_page = AppointmentTypePage(stem_appt_type_id, browser)
settings = type_page.get_settings()
AppointmentTypesListPage¶
-
class
autohandshake.
AppointmentTypesListPage
(browser: autohandshake.src.HandshakeBrowser.HandshakeBrowser)¶ The overview settings page listing all appointment types
Parameters: browser (HandshakeBrowser) – a logged-in HandshakeBrowser -
get_type_ids
(*args, **kwargs)¶ Get a list of appointment type IDs for your school
-
get_type_settings
(*args, **kwargs)¶ Get a list of settings objects for all appointment type settings.
The method returns a list of dicts, each of the form specified in
autohandshake.AppointmentTypePage.get_settings()
Parameters: how_many (int) – if specified, the number of settings objects to collect. If None (the default), collect all settings. This argument is mainly for testing purposes, as downloading the full list of settings is prohibitively slow for testing. Returns: a list of type settings objects for all appointment types Return type: list
-
Example¶
from autohandshake import HandshakeSession, AppointmentTypesListPage
with HandshakeSession(school_url, email) as browser:
types_page = AppointmentTypesListPage(browser)
all_settings = types_page.get_type_settings()
InsightsPage¶
-
class
autohandshake.
InsightsPage
(url_string: str, browser: autohandshake.src.HandshakeBrowser.HandshakeBrowser)¶ Handshake’s custom data reporting page (powered by Looker)
Parameters: - url_string (str) – either a full insights URL or just the alphanumeric query string specifying the exact report
- browser (HandshakeBrowser) – a logged-in HandshakeBrowser
-
download_file
(*args, **kwargs)¶ Download the Insights report’s data in a file of the specified type
Parameters: - file_type (FileType) – the type of file to download
- download_dir (str) – the directory into which Insights will download the file. This is used to confirm that the file downloaded successfully, not to tell Insights where to download the file (Insights has no power over that).
- file_name (str) – the name of the file to download. If None, default to Handshake’s standard naming of Insights files
- max_wait_time (int) – the maximum amount of time to wait for the file to download without throwing an error
- limit (int) – The maximum number of rows to retrieve. By default, there is no limit.
Returns: the filepath of the newly-downloaded file
Return type: str
-
get_data
(*args, **kwargs)¶ Get a JSON-like list of dict representation of the Insights report’s data
Parameters: limit (int) – The maximum number of rows to retrieve. By default, there is no limit. Returns: the Insight report’s data in list-of-dict/JSON-like format Return type: list
-
set_date_range_filter
(*args, **kwargs)¶ Set a date range filter on the Insights report to the given start and end date.
Insights date filters are identified by a two-part name: the first part indicates the “category” or subject matter the date refers to, and the second part indicates the specific date field on that category.
For example: the filter for the start date of an appointment is called “Appointments Start Date Date.” In the Insights filter box, this title appears with the “Start Date Date” part in bold and the “Appointments” part in regular type. In this case “Appointments” is the field_category, and “Start Date Date” is the field_title. This methods requires both parts of the name in order to apply the given start and end dates to the correct filter.
IMPORTANT: at this time, this method only works on date range filters that follow the form “[Category] [Title] is in range [start] until (before) [end].” The method does not work on month or time filters, or on filters that do not represent a range between two time-less dates. Also, the filter must already exist in the Insights page; this method will not create a filter, merely modify the dates of an existing one.
Parameters: - field_category (str) – the date filter’s category name (see method description)
- field_title (str) – the date filter’s title (see method description)
- start_date (date) – the start date to use in the filter
- end_date (date) – the end date to use in the filter. IMPORTANT: Handshake date ranges go up to but not including the end date, so a filter from 1/15/19 to 1/30/19 will NOT include any data from 1/30/19, for example.
-
class
autohandshake.
FileType
¶ The possible download file types in Insights
- EXCEL - an excel file with a .xlsx extension
- TXT - a tab-separated .txt file
- JSON - a json file with a .json extension
- HTML - a .html file that can render the data table in a browser
- MARKDOWN - a .md file that renders the table in markdown
- PNG - a .png image of the data table
- CSV - a comma-separated .csv file
Example¶
from autohandshake import HandshakeSession, InsightsPage, FileType
import datetime
# you can use either the full url or just the query string portion to instantiate the page.
full_url = 'https://app.joinhandshake.com/analytics/explore_embed?insights_page=ZXhwbG9yZS9nZW5lcmF0ZWRfaGFuZHNoYWtlX3Byb2R1Y3Rpb24vYXBwb2ludG1lbnRzP3FpZD1pcDFLd0ZlSmh4VVdobXYxa212U2xuJmVtYmVkX2RvbWFpbj1odHRwczolMkYlMkZhcHAuam9pbmhhbmRzaGFrZS5jb20mdG9nZ2xlPWZpbA=='
query_str = 'ZXhwbG9yZS9nZW5lcmF0ZWRfaGFuZHNoYWtlX3Byb2R1Y3Rpb24vYXBwb2ludG1lbnRzP3FpZD1pcDFLd0ZlSmh4VVdobXYxa212U2xuJmVtYmVkX2RvbWFpbj1odHRwczolMkYlMkZhcHAuam9pbmhhbmRzaGFrZS5jb20mdG9nZ2xlPWZpbA=='
with HandshakeSession(school_url, email) as browser:
full_url_insights_page = InsightsPage(full_url, browser)
# load the data into python as a list of dicts for further manipulation
report_data = full_url_insights_page.get_data()
query_insights_page = InsightsPage(query_str, browser)
# change the date range filter of the report before downloading the results as an excel file
query_insights_page.set_date_range_filter('Appointments', 'Start Date Date',
start_date = datetime.datetime(2018, 1, 1),
end_date = datetime.datetime(2019, 1, 1))
query_insights_page.download_file(download_dir = 'C:\\Users\\user425\\Downloads\\',
file_name = 'appointment_data_by_status.xlsx',
file_type = FileType.EXCEL)
MajorSettingsPage¶
-
class
autohandshake.
MajorSettingsPage
(browser: autohandshake.src.HandshakeBrowser.HandshakeBrowser)¶ Parameters: browser (HandshakeBrowser) – a logged-in HandshakeBrowser -
get_major_mapping
(*args, **kwargs)¶ Get a list of all the school’s majors and their associated major groups.
Returns: a list of major-to-major-group mapping dicts, of the form: {‘major’: ‘major name’, ‘groups’: [‘group 1’, ‘group 2’, etc]} Return type: list
-
Example¶
from autohandshake import HandshakeSession, MajorSettingsPage
with HandshakeSession(school_url, email) as browser:
major_settings_page = MajorSettingsPage(browser)
mapping = major_settings_page.get_major_mapping()
InterviewSchedulePage¶
-
class
autohandshake.
InterviewSchedulePage
(schedule_id: int, browser: autohandshake.src.HandshakeBrowser.HandshakeBrowser)¶ The main page for an Interview Schedule.
Parameters: - type_id (int) – the id of the interview schedule to load
- browser (HandshakeBrowser) – a logged-in HandshakeBrowser
-
get_contact_info
(*args, **kwargs)¶ Retrieve the name and email of each person listed under “Contacts” on the interview schedule page.
Method returns a list of dicts of the form:
[ {'name': 'Jane Recruiter', 'email': 'jrec@company.com'}, {'name': 'John Employer', 'email': 'jemp@company.com'} ]
Returns: a list of dicts containing contact info
-
get_reserved_rooms
(*args, **kwargs)¶ Get the number of rooms reserved for the interview schedule.
Returns: the number of rooms reserved for the schedule
Example¶
from autohandshake import HandshakeSession, InterviewSchedulePage
schedule_id = 452361
with HandshakeSession(school_url, email) as browser:
interview_page = InterviewSchedulePage(schedule_id, browser)
contacts = interview_page.get_contacts()
reserved_rooms = interview_page.get_reserved_rooms()
SurveyPage¶
-
class
autohandshake.
SurveyPage
(survey_id: int, browser: autohandshake.src.HandshakeBrowser.HandshakeBrowser)¶ A survey page in Handshake.
Parameters: - survey_id (int) – the id of the survey to load
- browser (HandshakeBrowser) – a logged-in HandshakeBrowser
-
download_responses
(*args, **kwargs)¶ Download a CSV of the survey responses.
Parameters: - download_dir (str) – the directory into which the survey responses will download
- wait_time (int) – the maximum time to wait for the download to appear
Returns: the file path of the downloaded file
Return type: str
Example¶
from autohandshake import HandshakeSession, SurveyPage
survey_id = 8279252
download_dir = 'C:\\Users\\username\\Downloads\\'
with HandshakeSession(school_url, email) as browser:
survey = SurveyPage(survey_id, browser)
filepath = survey.download_responses(download_dir)
# do something with the downloaded file
CareerInterestsPage¶
-
class
autohandshake.
CareerInterestsPage
(student_id: int, browser: autohandshake.src.HandshakeBrowser.HandshakeBrowser)¶ A settings page for a single student’s career interests.
Only accessible while logged in as a student. Currently, the main utility of this class is allowing for the automated selection and deselection of Career Clusters.
Parameters: - student_id (int) – the id of the student whose career interests page you are to visit
- browser (HandshakeBrowser) – a logged-in HandshakeBrowser
-
cluster_is_selected_by_id
(*args, **kwargs)¶ Check whether or not a specific cluster is selected, given the cluster ID.
Parameters: cluster_id (int) – the id of the cluster to check Returns: True if the cluster is selected, false otherwise
-
cluster_is_selected_by_name
(*args, **kwargs)¶ Check whether or not a specific cluster is selected, given the cluster name.
Parameters: cluster_name (str) – the name of the cluster to check (case-sensitive) Returns: True if the cluster is selected, false otherwise
-
deselect_cluster_by_id
(*args, **kwargs)¶ Deselect a career cluster given its ID.
Parameters: cluster_id (int) – the id of the cluster to deselect
-
deselect_cluster_by_name
(*args, **kwargs)¶ Deselect a career cluster given its name.
Parameters: cluster_name (str) – the name of the cluster to deselect (case-sensitive)
-
save_interests
(*args, **kwargs)¶ Save any changes made to the student’s career interests.
You must call this method after making any changes to a student’s career interests if you would like those changes to persist.
-
select_cluster_by_id
(*args, **kwargs)¶ Select a career cluster given its id.
Parameters: cluster_id (int) – the id of the cluster to select
-
select_cluster_by_name
(*args, **kwargs)¶ Select a career cluster given its name.
Parameters: cluster_name (str) – the name of the cluster to select (case-sensitive)
Example¶
from autohandshake import HandshakeSession, ViewAsStudent, CareerInterestsPage
student_id = 198427
career_clusters = ['Finance Cluster', 'STEM Cluster']
with HandshakeSession(school_url, email) as browser:
with ViewAsStudent(student_id, browser):
interests_page = CareerInterestsPage(student_id, browser)
for cluster in career_clusters:
interests_page.select_cluster_by_name(cluster)
interests_page.save_interests()
WaitingRoomPage¶
-
class
autohandshake.
WaitingRoomPage
(browser: autohandshake.src.HandshakeBrowser.HandshakeBrowser)¶ The Handshake appointment waiting room page.
All office location filters are automatically cleared upon loading the page.
Parameters: browser (HandshakeBrowser) – a logged-in HandshakeBrowser -
get_checkin_data
(*args, **kwargs)¶ Get student checkin data from the waiting room.
Data is returned in the format:
[ { 'being_created': True, 'student_id': 2284230, 'student_name': 'John Ferguson', 'datetime': datetime.datetime(2018, 10, 31, 14, 33), 'office_location': 'Rogers Hall Room 302' }, { 'being_created': False, 'student_id': 6574835, 'student_name': 'Alyssa Fernandez', 'datetime': datetime.datetime(2018, 11, 3, 9, 50), 'office_location': None } ]
Returns: a list of student checkin data dicts
-
Example¶
from autohandshake import HandshakeSession, ViewAsStudent, CareerInterestsPage
with HandshakeSession(school_url, email) as browser:
waiting_room = WaitingRoomPage(browser)
waiting_room_data = waiting_room.get_checkin_data()
EventsPage¶
-
class
autohandshake.
EventsPage
(browser: autohandshake.src.HandshakeBrowser.HandshakeBrowser)¶ The main Events page in Handshake.
Parameters: browser (HandshakeBrowser) – a logged-in HandshakeBrowser -
download_event_data
(*args, **kwargs)¶ Download a CSV of the event data matching the page’s current filters.
Parameters: - download_dir (str) – the directory into which the file will download
- wait_time (int) – the maximum time to wait for the download to appear
Returns: the file path of the downloaded file
Return type: str
-
load_saved_search
(*args, **kwargs)¶ Given the case-sensitive name of a saved search, apply that search.
-
Example¶
from autohandshake import HandshakeSession, EventsPage
saved_search = 'This is a Case Sensitive Saved Search Name'
download_dir = 'C:\\Users\\username\\Downloads\\'
with HandshakeSession(school_url, email) as browser:
events_page = EventsPage(browser)
events_page.load_saved_search(saved_search)
filepath = events_page.download_event_data(download_dir, wait_time=500)
# do something with the downloaded file
EventPage¶
-
class
autohandshake.
EventPage
(event_id: int, browser: autohandshake.src.HandshakeBrowser.HandshakeBrowser)¶ A specific Event page in Handshake.
Parameters: - event_id (int) – the id of the event page to visit
- browser (HandshakeBrowser) – a logged-in HandshakeBrowser
-
get_invited_schools
(*args, **kwargs)¶ Get a list of the names of schools invited to the event
Example¶
from autohandshake import HandshakeSession, EventPage
event_id = 128345
with HandshakeSession(school_url, email) as browser:
event_page = EventPage(event_id, browser)
invited_schools = event_page.get_invited_schools()
# do something with invited schools
LabelSettingsPage¶
-
class
autohandshake.
LabelSettingsPage
(browser: autohandshake.src.HandshakeBrowser.HandshakeBrowser)¶ Parameters: browser (HandshakeBrowser) – a logged-in HandshakeBrowser -
get_label_data
(*args, **kwargs)¶ Get a list of all the school’s labels and their usage data.
Returns: a list of label data dicts, of the form: { 'label_name': 'preferred employer', # the name of the label 'usage_counts': { # how many times the label has been used in different system modules 'Job': 43, 'Event': 55, 'InterviewSchedule': 23 }, 'used_for': 'All', # the primary module this label is used for. Labels used for multiple modules are marked 'All' 'created_by_first_name': 'John', # the first name of the user who created the label 'created_by_last_name': 'Staffmember', # the last name of the user who created the label 'label_type': 'normal' # the label type. One of 'normal', 'system' or 'public' }
Return type: list
-
Example¶
from autohandshake import HandshakeSession, LabelSettingsPage
with HandshakeSession(school_url, email) as browser:
label_settings_page = LabelSettingsPage(browser)
label_data = label_settings_page.get_label_data()
# do something with label data