Library Website Scraper¶
This documentation explains the methods of the StudySpaces
object. This SDK module is implemented by scraping the Penn Libraries LibCal
website.
-
class
penn.studyspaces.
StudySpaces
[source]¶ Used for interacting with the UPenn library GSR booking system.
Usage:
>>> from penn import StudySpaces >>> s = StudySpaces()
-
book_room
(building, room, start, end, firstname, lastname, email, groupname, phone, size, fake=False)[source]¶ Books a room given the required information.
Parameters: - building (int) – The ID of the building the room is in.
- room (int) – The ID of the room to book.
- start (datetime) – The start time range of when to book the room.
- end (datetime) – The end time range of when to book the room.
- fake (bool) – If this is set to true, don’t actually book the room. Default is false.
Returns: Boolean indicating whether the booking succeeded or not.
Raises: ValueError – If one of the fields is missing or incorrectly formatted, or if the server fails to book the room.
-
static
get_room_id_name_mapping
(building)[source]¶ Returns a dictionary mapping id to name, thumbnail, and capacity.
The dictionary also contains information about the lid and gid, which are used in the booking process.
Parameters: building (int) – The ID of the building to fetch rooms for. Returns: A list of rooms, with each item being a dictionary that contains the room id and available times.
-