Skip to content

Commit

Permalink
Update .gitignore and afc_dailycat.py
Browse files Browse the repository at this point in the history
  • Loading branch information
ptsgrn committed Mar 25, 2024
1 parent d438a28 commit 4f1f809
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 18 deletions.
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,8 @@ configstore/
*.log
errlog

pyvenv/
pyvenv/
user-password.py
apicache/
*.lwp
*/throttle.ctrl
17 changes: 2 additions & 15 deletions python/afc_dailycat.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,6 @@
'summary': 'สร้างหมวดหมู่ฉบับร่างสำหรับ [[WP:AfC]]',
}

# if no .env file, skip
if not os.path.exists('.env'):
print('No .env file found, skipping')
exit()
else:
with open('.env', 'r') as fh:
vars_dict = dict(
tuple(line.replace('\n', '').split('='))
for line in fh.readlines() if not line.startswith('#')
)
os.environ.update(vars_dict)

site = Site('th', 'wikipedia')

_month_name = {
Expand Down Expand Up @@ -52,7 +40,7 @@ def main():

def create_new_page(date_str):
pagename = opt['category'].format(date=date_str)
print("Creating page: " + pagename)
pywikibot.output('Creating page: ' + pagename)
page = pywikibot.Page(site, pagename)
if page.exists():
print('Page already exists')
Expand All @@ -61,5 +49,4 @@ def create_new_page(date_str):
page.save(summary=opt['summary'])


if __name__ == '__main__':
main()
main()
2 changes: 0 additions & 2 deletions python/user-config.py

This file was deleted.

0 comments on commit 4f1f809

Please sign in to comment.