Skip to content

Commit

Permalink
change args
Browse files Browse the repository at this point in the history
  • Loading branch information
ouyen committed Nov 23, 2021
1 parent ee856b7 commit f2478eb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 14 deletions.
9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,12 @@ youth:

1. Clone this repository.
2. Create github secrets (Settings --> Secrets --> New Repository secret):
* USERNAME: your account username (phone number). Visit [here](https://m.bjyouth.net/site/login) to retrieve.
* PASSWORD: your account password.
* ORG_ID: your organization id. Visit [here](https://m.bjyouth.net/qndxx/index.html#/pages/home/my) to retrieve.
* Use config.yaml (Recommended)
* REMOTE_CONFIG: Create a config.yaml , upload to [Gist](https://gist.github.com) to get raw's link (like https://gist.githubusercontent.com/ouyen/xxx/raw/xxx/config.yaml).
* Original plan
* USERNAME: your account username (phone number). Visit [here](https://m.bjyouth.net/site/login) to retrieve.
* PASSWORD: your account password.
* ORG_ID: your organization id. Visit [here](https://m.bjyouth.net/qndxx/index.html#/pages/home/my) to retrieve.

3. Edit `.github/workflow/main.yml`.
* by default it runs at *08:00 *on every Tuesday, change `cron` if you want to run at a different time.
Expand Down
11 changes: 0 additions & 11 deletions main.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import argparse
import json
import os
import re
Expand Down Expand Up @@ -241,9 +240,6 @@ def main_cli(args):
print('[INFO] Read config from command line parameters')
print('[INFO] Start')
youth = Youth()
# youth.username = args.username
# youth.password = args.password
# youth.org_id = args.org_id
youth.username = args["USERNAME"]
youth.password = args["PASSWORD"]
youth.org_id = args["ORG_ID"]
Expand All @@ -256,16 +252,9 @@ def main_cli(args):


if __name__ == '__main__':
# parser = argparse.ArgumentParser()
# parser.add_argument('--username', type=str)
# parser.add_argument('--password', type=str)
# parser.add_argument('--org_id', type=str)
# parser.add_argument('--remote_config', type=str)
# args = parser.parse_args()
ENV={_i:os.getenv(_i) for _i in ['PASSWORD','USERNAME','ORG_ID','REMOTE_CONFIG']}
if (ENV['REMOTE_CONFIG']):
main(ENV['REMOTE_CONFIG'])
# elif (args.username and args.password and args.org_id):
elif(ENV['USERNAME'] and ENV['PASSWORD'] and ENV['ORG_ID']):
main_cli(ENV)
else:
Expand Down

0 comments on commit f2478eb

Please sign in to comment.