Merge pull request #2 from SameerSahu007/main

added dataset.json
This commit is contained in:
Bhupesh Varshney 2022-08-20 22:35:16 +05:30 committed by GitHub
commit 174e2a6e16
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 27 additions and 21 deletions

20
dataset.json Normal file
View File

@ -0,0 +1,20 @@
{
"titles": [
"ranting about jira",
"siting in a meeting",
"squashing bugs",
"centering divs",
"waiting for staging deployment",
"writing tests",
"pushing directly to prod",
"doing code review",
"deleting jira tickets",
"Creating a pull request",
"forgot to run DB migrations",
"Broke production",
"running on staging ENV",
"merging git branches",
"releasing the MVP",
"finding JIRA tickets"
]
}

26
main.py
View File

@ -2,35 +2,20 @@ import praw
import os
import random
import time
titles = [
"ranting about jira",
"siting in a meeting",
"squashing bugs",
"centering divs",
"waiting for staging deployment",
"writing tests",
"pushing directly to prod",
"doing code review",
"deleting jira tickets",
"Creating a pull request",
"forgot to run DB migrations",
"Broke production",
"running on staging ENV",
"merging git branches",
"releasing the MVP",
"finding JIRA tickets"
]
import json
client_id = os.environ["REDDIT_CLIENT_ID"]
client_secret = os.environ["REDDIT_CLIENT_SECRET"]
reddit_pass = os.environ["REDDIT_PASSWORD"]
def get_titles():
with open('dataset.json', 'r') as f:
data = json.load(f)
titles = data['titles']
currentlyViewingText, subscribersText = random.sample(titles, 2)
return [currentlyViewingText, subscribersText]
def update_titles():
reddit = praw.Reddit(
client_id=client_id,
@ -53,4 +38,5 @@ def update_titles():
widgets.refresh()
widgets.id_card.mod.update(subscribersText=titles[1])
update_titles()