Browse Source

Moved the file so we can run it like a script and install it with pip

master
Roxie Gibson 4 years ago
parent
commit
c7bb316e49
No known key found for this signature in database
4 changed files with 63 additions and 14 deletions
  1. +10
    -0
      .gitignore
  2. +15
    -0
      readme.md
  3. +25
    -14
      seatingplan/__main__.py
  4. +13
    -0
      setup.py

+ 10
- 0
.gitignore View File

@@ -0,0 +1,10 @@

\.idea/

access_token\.txt

config

venv/

\.vscode/

+ 15
- 0
readme.md View File

@@ -0,0 +1,15 @@

# Seating Plan Generator

Script to generate a seating plan via calendar events in an organsations Office365.

## What it does

The script looks at the current week and generates a seating plan for that week. **Note** Current week is defined during the normal work weeks. If the script is ran on the weekend (Saturday and Sunday) the script will generate next weeks and label it as such.

## Installation

TO BE WRITTEN


**MAKE SURE TO READ OVER THIS BEFORE SENDING TO CLIENT**

run.py → seatingplan/__main__.py View File

@@ -80,22 +80,33 @@ def get_week_datetime():
return monday, friday


session = create_session()
authenticate_session(session)
def main():
"""
Main function that is ran on start up. Script is ran from here.
"""
session = create_session()
authenticate_session(session)

r = oauth_request(session.con, "https://outlook.office.com/api/v2.0/users/EMAIL/")

# request = account.con.oauth_request("https://outlook.office.com/api/v2.0/users/EMAIL/calendar/events?$filter=Start/DateTime ge '2019-09-04T08:00' AND End/Datetime le '2019-09-05T08:00'&$top=50", "get")
print(r.text)

# setup csv
# For loop over all emails
# API request for user info of email
# Get display name
# API request for events this week
# Find sign of being in or not being in
# insert name in csv for the days they are in and at what seat (if regular)


r = oauth_request(session.con, "https://outlook.office.com/api/v2.0/users/EMAIL/")
monday, friday = get_week_datetime()
print(f"Monday is {monday}, Friday is {friday}")

# request = account.con.oauth_request("https://outlook.office.com/api/v2.0/users/EMAIL/calendar/events?$filter=Start/DateTime ge '2019-09-04T08:00' AND End/Datetime le '2019-09-05T08:00'&$top=50", "get")
print(r.text)

# setup csv
# For loop over all emails
# API request for user info of email
# Get display name
# API request for events this week
# Find sign of being in or not being in
# insert name in csv for the days they are in and at what seat (if regular)


monday, friday = get_week_datetime()
print(f"Monday is {monday}, Friday is {friday}")
if __name__ == "__main__":
main()

+ 13
- 0
setup.py View File

@@ -0,0 +1,13 @@
import setuptools

# TODO: This needs to generate a config and make sure it is installed

setuptools.setup(
name="Seating Plan Generator",
author="Roxanne Gibson",
author_email="me@roxanne.dev",
description="Script to generate a seating plan via Office365 Calendars",
packages=["seatingplan"],
entry_points={"console_scripts": ["seatingplan=seatingplan.__main__:main"]},
python_requires=">=3.5",
)

Loading…
Cancel
Save