Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit5ff172a

Browse files
committed
Locally specify paths to roster and pswd
1 parenta23ec46 commit5ff172a

File tree

6 files changed

+26
-20
lines changed

6 files changed

+26
-20
lines changed

‎README.md‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,12 @@ Create a conda environment with all dependencies:
1717

1818
##Running
1919

20-
1. Specify the URLs that you'd like to track (andoptionally, their options) by
21-
editing`roster.json`; see`roster.json.example`.
20+
1. Specify the URLs that you'd like to track (andoptional URL-specific
21+
arguments) by editing`./roster.json`.
2222

23-
1. Edit`gmail_app_pswd`, with its content being your Gmail app-specific password
24-
(a Gmail-only password; see how to set one up[here](https://support.google.com/accounts/answer/185833?hl=en)).
23+
1. Create a file`./gmail_app_pswd`, with its content being your Gmail
24+
*app-specific* password (NOT your Google account password; see how to set one
25+
up[here](https://support.google.com/accounts/answer/185833?hl=en)).
2526

2627
1. Activate the environment and run the monitor:
2728

‎gmail_app_pswd‎

Lines changed: 0 additions & 1 deletion
This file was deleted.

‎main.py‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@
1515

1616
FLAGS=flags.FLAGS
1717
flags.DEFINE_string('roster_json','./roster.json','path to the roster')
18-
flags.DEFINE_string('gmail','xiuming6zhang@gmail.com','email address')
18+
flags.DEFINE_string('gmail','xiuming6zhang@gmail.com','Gmail address')
19+
flags.DEFINE_string('gmail_pswd_path','./gmail_app_pswd',
20+
'Gmail app-specific password')
1921
flags.DEFINE_integer('check_every',43200,'check every N seconds')
2022
flags.DEFINE_integer('exit_after',None,'quit after N seconds')
2123
flags.DEFINE_string('snapshot_dir','./snapshots',
@@ -71,7 +73,10 @@ def main(_):
7173
msg=''
7274
forurl,deltainzip(changed,deltas):
7375
msg+=f'------\n{url}\n\n{delta}\n\n\n'
74-
util.email_oneself(msg,FLAGS.gmail,subject='Webpage Monitor')
76+
util.email_oneself(msg,
77+
FLAGS.gmail,
78+
gmail_pswd_path=FLAGS.gmail_pswd_path,
79+
subject='Webpage Monitor')
7580

7681
logging.info('Change detected; email sent')
7782
else:

‎roster.json‎

Lines changed: 0 additions & 1 deletion
This file was deleted.

‎roster.json‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"https://xiuming.info/": {},
3+
"https://www.weizmann.ac.il/math/dekel/publications-0": {
4+
"ignore_prefix": [
5+
"<script>jQuery.extend",
6+
"<script id=\"f5_cspm\">"
7+
]
8+
}
9+
}

‎roster.json.example‎

Lines changed: 0 additions & 10 deletions
This file was deleted.

‎util.py‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,11 @@ def folder_name_from_url(url):
2323
returnfolder_name
2424

2525

26-
defemail_oneself(msg,gmail,subject='Untitled',pswd_path='./gmail_app_pswd'):
27-
pswd=read_file(pswd_path)
26+
defemail_oneself(msg,
27+
gmail,
28+
gmail_pswd_path='./gmail_app_pswd',
29+
subject='Untitled'):
30+
pswd=read_file(gmail_pswd_path)
2831
pswd=pswd.strip()
2932

3033
to_emails= [gmail]

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp