Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sgersapp #7

Open
wants to merge 231 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
231 commits
Select commit Hold shift + click to select a range
4f6ab22
cleanup: reorganize code
sgersapp Aug 25, 2016
9c4a560
Merge pull request #1 from saishg/cleanup
saishg Aug 25, 2016
1fb3c9f
cleanup: Organize into a class
sgersapp Aug 25, 2016
1b949f3
Merge pull request #2 from saishg/cleanup
saishg Aug 25, 2016
804b3ce
cleanup: Add room count to CSV
sgersapp Aug 25, 2016
7bd91ea
cleanup
sgersapp Aug 25, 2016
f03b830
cleanup: set default value in function arg
sgersapp Aug 25, 2016
418a2da
cleanup: make object oriented
sgersapp Aug 25, 2016
9397486
cleanup: timezone hack
sgersapp Aug 25, 2016
1abe22b
mrathor: Add WebService APIs
Aug 25, 2016
e8c5492
cleanup: Fix search for free rooms, using 15 min intervals
sgersapp Aug 25, 2016
4f602d9
Merge pull request #3 from saishg/cleanup
saishg Aug 25, 2016
ced47bf
mrathor: Merge branch 'master' of https://github.com/saishg/roomfinde…
Aug 25, 2016
acd12ee
cleanup: add ability to specify rooms file
sgersapp Aug 25, 2016
86f6697
Merge pull request #4 from saishg/cleanup
saishg Aug 25, 2016
5e217b8
mrathor: Merge branch 'master' of https://github.com/saishg/roomfinde…
Aug 25, 2016
ec8896f
cleanup: end time fix in constructor
sgersapp Aug 25, 2016
6ae2426
Merge pull request #5 from saishg/cleanup
saishg Aug 25, 2016
8e4b584
mrathor: Merge branch 'master' of https://github.com/saishg/roomfinde…
Aug 25, 2016
89386df
mrathor: Use API call
Aug 25, 2016
f2b3f2c
Merge pull request #6 from saishg/mrathor
Aug 25, 2016
06439d8
cleanup: add support for prefix
sgersapp Aug 25, 2016
9f33d6d
Merge pull request #7 from saishg/cleanup
saishg Aug 25, 2016
1e3503b
mrathor: Call Search Free API
Aug 25, 2016
26a098d
Merge pull request #8 from saishg/mrathor
Aug 25, 2016
bfab827
cleanup: Switch to using duration
sgersapp Aug 25, 2016
ee3cdea
cleanup: Merge remote-tracking branch 'origin' into cleanup
sgersapp Aug 25, 2016
718b8a9
cleanup: change to use duration
sgersapp Aug 25, 2016
59142ce
Merge pull request #9 from saishg/cleanup
saishg Aug 25, 2016
0b61888
UI
mobaqar Aug 25, 2016
c0c54bb
mrathor: Add API to get list of buildings
Aug 25, 2016
a849e2c
Merge pull request #10 from saishg/mrathor
Aug 25, 2016
6cc58cb
cleanup: UI fixes
sgersapp Aug 25, 2016
99d0156
Fix timezone issue
asawalka Aug 25, 2016
a43e0b1
Merge remote-tracking branch 'origin' into cleanup
asawalka Aug 25, 2016
719dfa1
Merge branch 'cleanup' of https://github.com/saishg/roomfinder into c…
asawalka Aug 25, 2016
c920522
Merge pull request #11 from saishg/cleanup
saishg Aug 25, 2016
7aad4e2
cleanup: Fix timezone for real
sgersapp Aug 25, 2016
e2461c8
Merge pull request #12 from saishg/cleanup
saishg Aug 25, 2016
06701fa
cleanup: Add date
sgersapp Aug 25, 2016
1a6ebee
Merge pull request #13 from saishg/cleanup
saishg Aug 25, 2016
9ec8a4a
cleanup: render result json as a table
sgersapp Aug 25, 2016
c70aea1
Merge pull request #14 from saishg/cleanup
saishg Aug 25, 2016
9e0dce9
sgersapp: Handle duration with both h and m
sgersapp Aug 25, 2016
97295e5
Merge pull request #16 from saishg/sgersapp
saishg Aug 25, 2016
7e52bb2
mrathor: Add GUI and JS
Aug 25, 2016
934c079
Merge pull request #17 from saishg/mrathor
Aug 25, 2016
3ce5667
mrathor: Update Index.html
Aug 25, 2016
72e9a77
mrathor: Merge branch 'master' of https://github.com/saishg/roomfinde…
Aug 25, 2016
b8982a1
mrathor: Remove Room Size list
Aug 25, 2016
142512b
mrathor: Remove Room Size list
Aug 25, 2016
dcc25f8
Merge pull request #18 from saishg/mrathor
Aug 25, 2016
80cec0f
sgersapp: threading to speed up queries
sgersapp Aug 25, 2016
14cd195
Merge pull request #19 from saishg/sgersapp
saishg Aug 25, 2016
bee89c5
mrathor: Reserve room API
Aug 25, 2016
5cec942
Merge pull request #20 from saishg/mrathor
Aug 25, 2016
86bac99
mrathor: Update Date Field
Aug 25, 2016
ffe4afd
Merge pull request #21 from saishg/mrathor
Aug 25, 2016
b7cc924
sgersapp: Use base64 password
sgersapp Aug 25, 2016
57c1279
sgersapp: Handle exceptions from room finder
sgersapp Aug 25, 2016
3a2c17b
sgersapp: Auto select today's date and hour
sgersapp Aug 25, 2016
22d21c9
Merge pull request #22 from saishg/sgersapp
saishg Aug 25, 2016
71221bc
mrathor: Update find rooms
Aug 25, 2016
8a96759
mrathor: Merge branch 'master' of https://github.com/saishg/roomfinde…
Aug 25, 2016
29a3507
sgersapp: cleanup
sgersapp Aug 25, 2016
4419c13
sgersapp: support min room size
sgersapp Aug 25, 2016
59a0379
Merge pull request #23 from saishg/sgersapp
saishg Aug 25, 2016
06d318f
Fix room reservation
asawalka Aug 25, 2016
905feec
Merge pull request #24 from saishg/asawalka
saishg Aug 26, 2016
1b47568
mrathor: Fix Book Room
Aug 26, 2016
e6d4fdf
mrathor: Add room reserve link in HTML table
Aug 26, 2016
9d69564
mrathor: Fix Book Room
Aug 26, 2016
0090f61
Merge pull request #25 from saishg/mrathor
Aug 26, 2016
48e6d17
sgersapp: Fix room booking
sgersapp Aug 26, 2016
1cc4e30
Merge pull request #26 from saishg/sgersapp
saishg Aug 26, 2016
bd46adb
sgersapp: Fix room name in booking
sgersapp Aug 26, 2016
6e02750
Merge pull request #27 from saishg/sgersapp
saishg Aug 26, 2016
2cebc1f
sgersapp: Change Reserve from link to button
sgersapp Aug 26, 2016
6e9a0bc
Merge pull request #28 from saishg/sgersapp
saishg Aug 26, 2016
7922826
sgersapp: Fix room size comparison
sgersapp Aug 26, 2016
2ec2345
sgersapp: Fix default time selection for early morning
sgersapp Aug 26, 2016
9963dfa
sgersapp: Get user timezone for querying available rooms
sgersapp Aug 26, 2016
f24c1ca
Merge pull request #29 from saishg/sgersapp
saishg Aug 26, 2016
18f398a
sgersapp: Make all the code timezone aware
sgersapp Aug 26, 2016
fd04d3d
Merge pull request #30 from saishg/sgersapp
saishg Aug 26, 2016
7a4783f
sgersapp: Use user's timezone
sgersapp Aug 29, 2016
d183bf3
sgersapp: Better logs, error handling
sgersapp Aug 29, 2016
daacc33
Merge pull request #31 from saishg/sgersapp
saishg Aug 29, 2016
58ac489
sgersapp: better error and success messages
sgersapp Aug 29, 2016
76fb82e
Merge pull request #32 from saishg/sgersapp
saishg Aug 29, 2016
77acb86
sgersapp: Support for HTTPS
sgersapp Aug 29, 2016
b314bae
sgersapp: Make https optional
sgersapp Aug 29, 2016
5783704
Merge pull request #33 from saishg/sgersapp
saishg Aug 29, 2016
3a0f921
sgersapp: use only one CSV for rooms
sgersapp Aug 30, 2016
8eb277d
sgersapp: Move common defaults to common.py
sgersapp Aug 30, 2016
8711e67
sgersapp: Merge remote-tracking branch 'origin/master' into sgersapp
sgersapp Aug 30, 2016
51c4d97
Merge pull request #34 from saishg/sgersapp
saishg Aug 30, 2016
b899ecb
sgersapp: Merge branch 'master' of https://github.com/saishg/roomfind…
sgersapp Aug 30, 2016
09dfcad
sgersapp: logging support
sgersapp Aug 31, 2016
a940b5d
Merge pull request #35 from saishg/sgersapp
saishg Aug 31, 2016
17f3311
sgersapp: Improve logging, disable logging of sensitive information
sgersapp Aug 31, 2016
d71353d
Merge pull request #36 from saishg/sgersapp
saishg Aug 31, 2016
6661cbc
sgersapp: handle auth errors
sgersapp Aug 31, 2016
b23662d
Merge pull request #37 from saishg/sgersapp
saishg Aug 31, 2016
d3013b5
sgersapp: Use gunicorn to run app
sgersapp Sep 1, 2016
c6f02ab
Merge pull request #38 from saishg/sgersapp
saishg Sep 1, 2016
34a4fd0
sgersapp: Separte out exchange functionality into separate API
sgersapp Sep 2, 2016
2824dd0
sgersapp: Slight change to API
sgersapp Sep 2, 2016
38f09c7
sgersapp: Move reservation support to exchange API
sgersapp Sep 2, 2016
333924b
Merge pull request #39 from saishg/sgersapp
saishg Sep 2, 2016
74430d7
sgersapp: Fix bug in diplaying error on WebUI
sgersapp Sep 2, 2016
1631604
Merge pull request #40 from saishg/sgersapp
saishg Sep 2, 2016
9705608
sgersapp: Move common code to common.py
sgersapp Sep 2, 2016
b0d17f0
sgersapp: Move find room functionality to exchange API
sgersapp Sep 2, 2016
c3b7140
sgersapp: Ability to append new rooms to existing list
sgersapp Sep 2, 2016
800f726
sgersapp: fix pylint warnings
sgersapp Sep 2, 2016
2021763
sgersapp: Handle auth failure while reserving room
sgersapp Sep 2, 2016
ca887fd
Merge pull request #41 from saishg/sgersapp
saishg Sep 2, 2016
8845f44
sgersapp: Update docs
sgersapp Sep 2, 2016
886f47c
sgersapp: Merge branch 'master' of https://github.com/saishg/roomfind…
sgersapp Sep 2, 2016
b8f5ca0
sgersapp: Fix command-line usage
sgersapp Sep 2, 2016
a1bb9ea
Merge pull request #42 from saishg/sgersapp
saishg Sep 2, 2016
b406b92
sgersapp: First few unit tests
sgersapp Sep 3, 2016
0d8c963
sgersapp: Use DOMAIN to infer URL and email addresses
sgersapp Sep 3, 2016
a5f6cc1
Merge pull request #43 from saishg/sgersapp
saishg Sep 3, 2016
b87d946
sgersapp: Fix minor pylint issues
sgersapp Sep 3, 2016
82fa40a
sgersapp: Remove unneeded code
sgersapp Sep 3, 2016
691a57a
sgersapp: Fix minor pylint issues
sgersapp Sep 3, 2016
16094eb
Merge pull request #44 from saishg/sgersapp
saishg Sep 3, 2016
70e2161
sgersapp: Add tests for room reservation
sgersapp Sep 4, 2016
071948f
sgersapp: Add tests for room reservation
sgersapp Sep 4, 2016
ae46325
sgersapp: Fix a bug that made multiple identical calls to find_rooms
sgersapp Sep 4, 2016
cdb3efe
sgersapp: Unit tests for finding rooms
sgersapp Sep 4, 2016
32bb8a4
sgersapp: Min room size is 1
sgersapp Sep 4, 2016
4dc8f24
Merge pull request #45 from saishg/sgersapp
saishg Sep 4, 2016
f7f5c94
sgersapp: Fix pylint issues
sgersapp Sep 5, 2016
01d8cbc
Merge pull request #46 from saishg/sgersapp
saishg Sep 5, 2016
bfb542b
sgersapp: Move file handling functionality to common.py
sgersapp Sep 6, 2016
487e2d9
sgersapp: Refer to the global in common.py
sgersapp Sep 7, 2016
79cf778
sgersapp: Minor fixes
sgersapp Sep 7, 2016
daf69eb
sgersapp: Fetch floors when building is selected
sgersapp Sep 7, 2016
6063056
sgersapp: Fix dropdown options
sgersapp Sep 7, 2016
8e701b7
sgersapp: Add support for choosing any floor in a building
sgersapp Sep 7, 2016
80b763d
Merge pull request #47 from saishg/sgersapp
saishg Sep 7, 2016
b73acec
sgersapp: Re-align inputs
sgersapp Sep 7, 2016
d1c87ff
sgersapp: Add caching; move building and floor parsing code to common
sgersapp Sep 7, 2016
e2ef424
sgersapp: Fix append
sgersapp Sep 7, 2016
e819bed
sgersapp: Parse city and country
sgersapp Sep 7, 2016
676b796
sgersapp: Add city and country information for each room
sgersapp Sep 7, 2016
3a46444
sgersapp: UI changes for users to pick city
sgersapp Sep 7, 2016
542dadb
sgersapp: Ignore rooms with no city information
sgersapp Sep 7, 2016
07dc840
sgersapp: Fix pylint warnings
sgersapp Sep 7, 2016
f17c287
Merge pull request #48 from saishg/sgersapp
saishg Sep 7, 2016
6100c5a
sgersapp: Fix typo
sgersapp Sep 7, 2016
4e116f2
sgersapp: Rename CONFIG to gunicorn.cfg
sgersapp Sep 8, 2016
4a11cff
sgersapp: Sample exchange configuration
sgersapp Sep 9, 2016
961eaca
sgersapp: Gunicorn configuration
sgersapp Sep 9, 2016
bc76ac9
sgersapp: Support for anonymous access when searching
sgersapp Sep 9, 2016
62c1404
Merge pull request #49 from saishg/sgersapp
saishg Sep 9, 2016
77e9293
sgersapp: Hide username/password fields when not required
sgersapp Sep 9, 2016
a753c3b
Merge pull request #50 from saishg/sgersapp
saishg Sep 9, 2016
86ad8f5
sgersapp: Determine closest city using geolocation
sgersapp Sep 12, 2016
6ff20ad
sgersapp: Add more logging to track user activities
sgersapp Sep 12, 2016
39917e6
Merge pull request #51 from saishg/sgersapp
saishg Sep 12, 2016
42fed0c
sgersapp: City Coordinates
sgersapp Sep 12, 2016
d15455b
Merge pull request #52 from saishg/sgersapp
saishg Sep 12, 2016
64a17a2
sgersapp: Contact addresses
sgersapp Sep 23, 2016
21f7763
Merge pull request #53 from saishg/sgersapp
saishg Sep 23, 2016
d0b86c1
sgersapp: Correct email address
sgersapp Sep 23, 2016
865f471
Merge pull request #54 from saishg/sgersapp
saishg Sep 23, 2016
a049c08
sgersapp: Do not attempt reservation if username or password is blank
sgersapp Oct 7, 2016
58538ac
Merge pull request #55 from saishg/sgersapp
saishg Oct 7, 2016
082cefb
sgersapp: New webpage layout
sgersapp Oct 7, 2016
9626e38
Merge pull request #56 from saishg/sgersapp
saishg Oct 7, 2016
80b60ef
sgersapp: clean up inputs table
sgersapp Oct 7, 2016
a2ae8d8
Merge pull request #57 from saishg/sgersapp
saishg Oct 7, 2016
88f9e02
sgersapp: Add button to forward/rewind date
sgersapp Oct 8, 2016
c2253e0
New UI look for roomfinder
mobaqar Oct 10, 2016
3f5e810
sgersapp: Merge branch 'master' of https://github.com/saishg/roomfind…
sgersapp Oct 10, 2016
79780a7
sgersapp: Add code to retrieve city and building list
sgersapp Oct 10, 2016
bb4e83f
sgersapp: refresh building and floor list when city is changed
sgersapp Oct 10, 2016
fc4f5b1
change button color on selected time range
mobaqar Oct 10, 2016
e29a197
sgersapp: Specify end time directly
sgersapp Oct 10, 2016
172cff8
monika: Display floor map after successful reservation.
Oct 10, 2016
168fd18
sgersapp: Display the result table of available rooms
sgersapp Oct 11, 2016
2c2b1ef
sgersapp: Merge branch 'master' of https://github.com/saishg/roomfind…
sgersapp Oct 11, 2016
8e12a5d
sgersapp: Ability to Determine email from roomname, and ability to di…
sgersapp Oct 11, 2016
8f36981
sgersapp: Fix radiobutton
sgersapp Oct 11, 2016
e5d3417
sgersapp: Remove accidental debug statement
sgersapp Oct 11, 2016
b0f0fe6
sgersapp: Style issues
sgersapp Oct 11, 2016
03896d3
sgersapp: Fix geolocation
sgersapp Oct 11, 2016
d8af5f5
sgersapp: Show success and failure messages
sgersapp Oct 11, 2016
edccbf4
sgersapp: Webserver for the UI revamp
sgersapp Oct 11, 2016
bbd7ef0
Merge pull request #59 from saishg/sgersapp
saishg Oct 11, 2016
f4cdaf8
sgersapp: Make time selection more intuitive
sgersapp Oct 11, 2016
622caaf
sgersapp: Add 30 min intervals
sgersapp Oct 11, 2016
cb158bf
sgersapp: Hide experimental work
sgersapp Oct 11, 2016
4569ba2
Merge pull request #60 from saishg/sgersapp
saishg Oct 11, 2016
0d49934
monika: Merge branch 'master' of https://github.com/saishg/roomfinder…
Oct 11, 2016
b7e4315
monika: Display floor map in new UI.
Oct 11, 2016
e68a8ee
Merge pull request #61 from saishg/monika
Oct 11, 2016
26556a9
monika: Add direcory floormap in template folder.
Oct 11, 2016
cc11919
Merge pull request #62 from saishg/monika
Oct 11, 2016
4ddc8d3
sgersapp: Auto select current time
sgersapp Oct 12, 2016
b77dc8f
sgersapp: Improve default time selection accuracy and add auto scroll…
sgersapp Oct 12, 2016
571b1c0
Merge pull request #63 from saishg/sgersapp
saishg Oct 12, 2016
42e3852
sgersapp: Add default self-signed certificate and key to ease setup
sgersapp Oct 17, 2016
5914fd2
Merge pull request #64 from saishg/sgersapp
saishg Oct 17, 2016
76afc89
sgersapp: Move experimental code to mainstream
sgersapp Oct 17, 2016
fe5e9fa
Merge pull request #65 from saishg/sgersapp
saishg Oct 17, 2016
e9138f6
sgersapp: Refer to the correct files
sgersapp Oct 17, 2016
8fddd56
Merge pull request #66 from saishg/sgersapp
saishg Oct 17, 2016
3c2cf51
sgersapp: Replace old rooms with new ones
sgersapp May 1, 2017
0bd7f61
Merge pull request #67 from saishg/sgersapp
saishg May 1, 2017
b686a90
sgersapp: Add API to check current room status
sgersapp Sep 26, 2017
8856778
sgersapp: Query room status anonymously
sgersapp Sep 27, 2017
9a7d486
sgersapp: Fix pylint issues
sgersapp Sep 27, 2017
c8a833e
sgersapp: Better error handling
sgersapp Sep 27, 2017
87e0022
sgersapp: Add endpoint for querying room status
sgersapp Sep 27, 2017
fd1960b
Merge pull request #68 from saishg/sgersapp
saishg Sep 27, 2017
9f8df96
sgersapp: Fix errors caused by qoutes
sgersapp Sep 27, 2017
69b1b3b
Merge pull request #69 from saishg/sgersapp
saishg Sep 27, 2017
355bc60
sgersapp: Make time_now a function instead of a constant
sgersapp Sep 27, 2017
dc540e7
Merge pull request #70 from saishg/sgersapp
saishg Sep 27, 2017
81595c6
sgersapp: Anonymously running find_available_room
sgersapp Oct 24, 2017
a7bc1ee
sgersapp: Add API to query schedule for emails
sgersapp Oct 24, 2017
875b9b9
Merge pull request #71 from saishg/sgersapp
saishg Oct 24, 2017
5ab5405
sgersapp: Return combined schedule
sgersapp Oct 24, 2017
d8ff7f3
sgersapp: Fix logging error
sgersapp Oct 24, 2017
1fda1ca
Merge pull request #72 from saishg/sgersapp
saishg Oct 24, 2017
c75c60f
sgersapp: Fix summation when there are more than 2 emails
sgersapp Oct 25, 2017
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
*.pyc
*.bak
*.csv
*.swp
*.DS_Store
3 changes: 3 additions & 0 deletions DockerReadme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Make sure rooms.csv file contains list of rooms.
docker build -t room-finder .
docker run -d -p 5000:5000 room-finder
9 changes: 9 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
FROM ubuntu:latest
RUN apt-get update -y
RUN apt-get install -y python-pip python-dev build-essential
COPY . /app
WORKDIR /app
ENV PYTHONPATH $PYTHONPATH:/app/roomfinder
RUN pip install Flask==0.10.1
ENTRYPOINT ["python"]
CMD ["service/webserver.py"]
99 changes: 56 additions & 43 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,77 +4,90 @@ roomfinder
Python scripts for finding free conference rooms from a Microsoft Exchange Server.

Requirements:

- curl
- Python 2.7
- Access to Exchange Web Service (EWS) API of a Microsoft Exchange Server 2010
- Access to Exchange Web Service (EWS) API of a Microsoft Exchange Server 2010

Before running on the command-line, edit 'exchange_api.py' and modify your DOMAIN
to your organization's domain e.g. 'example.com', so that the URL points to
your Microsoft Exchange Server, e.g. 'https://mail.example.com/ews/exchange.asmx'

Usage:
Command-line Usage:

$ python find_rooms.py -h
usage: find_rooms.py [-h] -url URL -u USER [-d] prefix [prefix ...]
usage: find_rooms.py [-h] -u USER [-d] prefix [prefix ...]

positional arguments:
prefix A list of prefixes to search for. E.g. 'conference
confi'

optional arguments:
-h, --help show this help message and exit
-url URL, --url URL url for exhange server, e.g.
'https://mail.domain.com/ews/exchange.asmx'.
-u USER, --user USER user name for exchange/outlook
-d, --deep Attemp a deep search (takes longer).


Example:
$ python find_rooms.py Konferenzr. Konfi -url https://mail.mycompany.com/ews/exchange.asmx -u maier --deep

$ python find_rooms.py SJC19 -u sgersapp
Password:
After searching for prefix 'Konferenzr.' we found 100 rooms.
After deep search for prefix 'Konferenzr.' we found 143 rooms.
After searching for prefix 'Konfi' we found 151 rooms.
After deep search for prefix 'Konfi' we found 151 rooms.

This will create a CSV file `rooms.csv` holding a list of all rooms found with the prefix `Konfi` and `Konferenzr.` in their display names.
This will create a CSV file `rooms.csv` holding a list of all rooms found with the prefix `SJC19` in their display names.

After doing so, you can get the status for each of the rooms by calling
After doing so, you can check the status for each of the rooms by calling

$ python find_available_room.py -h
usage: find_available_room.py [-h] -url URL -u USER [-start STARTTIME]
usage: find_available_room.py [-h] -u USER [-start STARTTIME]
[-end ENDTIME] [-f FILE]

optional arguments:
-h, --help show this help message and exit
-url URL, --url URL url for exhange server, e.g.
'https://mail.domain.com/ews/exchange.asmx'.
-u USER, --user USER user name for exchange/outlook
-start STARTTIME, --starttime STARTTIME
Starttime e.g. 2014-07-02T11:00:00 (default = now)
-end ENDTIME, --endtime ENDTIME
Endtime e.g. 2014-07-02T12:00:00 (default = now+1h)
-f FILE, --file FILE csv filename with rooms to check (default=rooms.csv).
Format: Name,email

optional arguments:
-h, --help show this help message and exit
-u USER, --user USER user name for exchange/outlook
-prefix PREFIX, --prefix PREFIX
A prefix to search for. e.g. 'SJC19 SJC18'
-start STARTTIME, --starttime STARTTIME
Starttime e.g. 2014-07-02T11:00:00 (default = now)
-duration DURATION, --duration DURATION
Duration e.g. 1h or 15m (default = 1h)
-f FILE, --file FILE csv filename with room info (default=rooms.csv).


Example:

$ python find_available_room.py -url https://mail.mycompany.com/ews/exchange.asmx -u maier -start 2014-07-03T13:00:00 -end 2014-07-03T17:00:00
Password:
Busy Konferenzr. Asterix [email protected]
Tentative Konferenzr. Personal [email protected]
Busy Konferenzr. Obelix [email protected]
Busy Konfi Idefix [email protected]
Free Konferenzr. Miraculix [email protected]
...

Since the auto-generated list `rooms.csv` can be very huge it is recommended to copy that list to another file, e.g. `favorite_rooms.csv` and edit that file so that it only holds the meetings rooms you are interested in. After doing so, you can get the status for you favorite rooms very quickly using:
$ python find_available_room.py -u sgersapp -start 2014-07-03T13:00:00 -duration 1h

$ python find_available_room.py -url https://mail.mycompany.com/ews/exchange.asmx -u maier -start 2014-07-03T13:00:00 -end 2014-07-03T17:00:00 -f favorite_rooms.csv
Password:
Free Konferenzr. 007 [email protected]
Busy Konferenzr. Asterix [email protected]
Busy Konferenzr. Obelix [email protected]
Results are logged to the log file (default: access.log)

Eventually, you can reserve a rooms by calling

$ python book_room.py -h
usage: book_room.py [-h] -u USER [-start STARTTIME] [-d DURATION] -e ROOMEMAIL
-r ROOMNAME

optional arguments:
-h, --help show this help message and exit
-u USER, --user USER user name for exchange/outlook
-start STARTTIME, --starttime STARTTIME
Starttime e.g. 2014-07-02T11:00:00 (default = now)
-d DURATION, --duration DURATION
Duration e.g. 1h or 15m (default = 1h)
-e ROOMEMAIL, --roomemail ROOMEMAIL
Email address of the room
-r ROOMNAME, --roomname ROOMNAME
Name of room


Example:

$ python book_room.py -u sgersapp -start 2014-07-03T13:00:00 -duration 1h -r SJC19-3-SAISH -e [email protected]

You will receive a confirmation email from Exchange if the reservation is accepted or rejected.


Before starting the web-app, edit 'CONFIG' and pick the number of worker threads.
Generate a certificate and private key and point CONFIG to their locations.

Web-App:

$ ./run.sh

89 changes: 89 additions & 0 deletions book_room.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
APIs to request an Exchange Server reserve a room
"""

import argparse
import base64
import getpass
import sys
import urllib

import common
from exchange_api import ExchangeApi

reload(sys)
sys.setdefaultencoding("utf-8")

class ReserveAvailRoom(object):
""" Class to request an Exchange Server to reserve a room """

def __init__(self, user, password,
roomname, roomemail=None,
start_time=common.time_now(), duration=None, end_time=None,
raw_password=None,
timezone=common.SJ_TIME_ZONE):
self.user = user
self.roomname = roomname
if roomemail is None:
self.roomemail = common.read_room_list()[roomname]["email"]
else:
self.roomemail = roomemail
self.start_time = start_time
self.timezone = self._calc_timezone_str(timezone)
password = raw_password or base64.b64decode(urllib.unquote(password))
self.exchange_api = ExchangeApi(user, password)
if end_time is None:
self.end_time = common.end_time(self.start_time, duration)
if duration is None:
self.end_time = end_time

def _calc_timezone_str(self, timezone):
try:
timezone = int(timezone)
except ValueError:
timezone = common.SJ_TIME_ZONE
hours_offset = timezone / 60
minutes_offset = timezone % 60
sign = "-" if hours_offset < 0 else ""
return "{}PT{}H{}M".format(sign, abs(hours_offset), abs(minutes_offset))

def reserve_room(self):
""" Request reservation of specified room """
response = self.exchange_api.reserve_room( \
room_email=self.roomemail,
room_name=self.roomname,
start_time=self.start_time,
end_time=self.end_time,
timezone_offset=self.timezone)
return response

def run():
""" Parse command-line arguments and request room reservation """
parser = argparse.ArgumentParser()
parser.add_argument("-u", "--user", help="user name for exchange/outlook", required=True)
parser.add_argument("-start", "--starttime",
help="Starttime e.g. 2014-07-02T11:00:00 (default = now)",
default=common.time_now())
parser.add_argument("-d", "--duration",
help="Duration e.g. 30m (default = 1h)",
default='1h')
parser.add_argument("-e", "--roomemail",
help="Email address of room",
required=True)
parser.add_argument("-r", "--roomname",
help="Name of room",
required=True)

args = parser.parse_args()
args.password = base64.b64encode(getpass.getpass("Password:"))

room_finder = ReserveAvailRoom(user=args.user, password=args.password,
roomname=args.roomname, roomemail=args.roomemail,
start_time=args.starttime, duration=args.duration)
room_finder.reserve_room()


if __name__ == '__main__':
run()
39 changes: 39 additions & 0 deletions certs/cert.pem
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
-----BEGIN CERTIFICATE-----
MIIGxjCCBK6gAwIBAgIJAOUp2FQbFrEcMA0GCSqGSIb3DQEBBQUAMIGcMQswCQYD
VQQGEwJVUzELMAkGA1UECBMCQ0ExETAPBgNVBAcTCFNhbiBKb3NlMRcwFQYDVQQK
Ew5TYWlzaCBHZXJzYXBwYTEUMBIGA1UECxMLUm9vbSBGaW5kZXIxHTAbBgNVBAMT
FHJvb21maW5kZXIuY2lzY28uY29tMR8wHQYJKoZIhvcNAQkBFhBzYWlzaGdAZ21h
aWwuY29tMCAXDTE2MTAxNzA1MTUzMloYDzIxMTYwOTIzMDUxNTMyWjCBnDELMAkG
A1UEBhMCVVMxCzAJBgNVBAgTAkNBMREwDwYDVQQHEwhTYW4gSm9zZTEXMBUGA1UE
ChMOU2Fpc2ggR2Vyc2FwcGExFDASBgNVBAsTC1Jvb20gRmluZGVyMR0wGwYDVQQD
ExRyb29tZmluZGVyLmNpc2NvLmNvbTEfMB0GCSqGSIb3DQEJARYQc2Fpc2hnQGdt
YWlsLmNvbTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBALHWAKrOAWFh
cEtCNc0a5Bb24Ij1BQhop/laS8bvvREWXNOyqU4aQlbO/g5e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gjvfoUM2ZMVvaeUMy/AJSfhn13KzmWnbC67Z+DzykMhCESF+VAK
T71AAQrPG9DqlrbIYA78+ClMLtzfhp+KXkQRNZqGvBeaDHbYmaYVmDHYkg8OqoR0
waehcllJjGzXs39dp9ogulRdNL/LL7xT+lJTz/LkIwipQcd76MZMJP5b8erJgoe1
t1QxDVn/8JWl98W5E49Xl0QxGPytx2hXLettkKJaj43Ebm66G4pNQm0KMQxUDehT
B/SjTsacHIZakijDN0GPco3aVlDb5cBVW3lKYLG3U6O/eUVBnb9BE1TtaDzwz/vN
7wFoibSfSMHPEnVWFr72lG5GoCSxmJXJ+7adPk97yRzZb73wEmacJ5F5ZxCScDRm
4DNM1FB821as5Wiz6/7HsDrrQjMbi1yH3aqjU3Aj5rPbLDJ3ith/2GzEXBfuTXh3
I3klTJOmopkej3mB5JYF0SZ2l1+X9Zh8+XmkX3o/5XR+PyKLIuVSs/qnfpoaGVdG
yUN8yvj1PPgwQc1wpRPycJPb6ZMzaCFxCSJNrrIgASXiGUZdH4pjBD3n/Hxoix+f
H2+zU9i9rTF7EZEdmFe5Q6B76trbxAraZR+LcDIm9H+cGNGEVvzMbtHk+4u1giji
S524huW9+tHqLw==
-----END CERTIFICATE-----
51 changes: 51 additions & 0 deletions certs/key.pem
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
-----BEGIN RSA PRIVATE KEY-----
MIIJJwIBAAKCAgEAsdYAqs4BYWFwS0I1zRrkFvbgiPUFCGin+VpLxu+9ERZc07Kp
ThpCVs7+Dl4PNWJ6qvBCZdjdg+QDncwSqneleU1CdX1b4GMw88AiUFL1Hr7UFy4a
52yz+aASCWoqZ0IOIACMjRfyQLmWl40ZP4kCHKg1QrnJ8+B03IloEDy7ShqxNvD5
OfZFAt0/mx08JBqEkLbwYQ5iK9RN7Aza8gQeH6na5lmi9D98D43FJ1d5Ls5r3ofM
9yo4QESSC02+iAq7G4C8/4/+dR2HPZG0DkeXWci+oYoB+oStWBsQGaI8O4oIL1ma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