瀏覽代碼

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

master
Roxie Gibson 4 年之前
父節點
當前提交
c7bb316e49
沒有發現已知的金鑰在資料庫的簽署中
共有 4 個檔案被更改,包括 63 行新增14 行删除
  1. +10
    -0
      .gitignore
  2. +15
    -0
      readme.md
  3. +25
    -14
      seatingplan/__main__.py
  4. +13
    -0
      setup.py

+ 10
- 0
.gitignore 查看文件

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

\.idea/

access_token\.txt

config

venv/

\.vscode/

+ 15
- 0
readme.md 查看文件

@@ -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 查看文件

@@ -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 查看文件

@@ -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…
取消
儲存