Exemplo n.º 1
0
 def __init__(self,parent = None):
     QtGui.QDialog.__init__(self, parent, QtCore.Qt.WindowStaysOnTopHint)
     self.setupUi()
     try:
         config.auth("") # to check Password is in Config File
     except Exception, e:
         QtGui.QMessageBox.critical(self,"Configuration Error"," \n Run ariasetup")
         self.close()
         exit()
Exemplo n.º 2
0
def add_row(html, row, name):
    creds = auth()
    gc = gspread.authorize(creds)
    # sheet = gc.open_by_url('https://docs.google.com/spreadsheets/d/17yrMltdIA4UOPePk5ZDSjPhHbhqi3-w6X9Zuby198OU/edit#gid=0').sheet1
    sheet = gc.open_by_url(html)
    row[2] = row[2].replace('\\', '')
    row[4] = row[4].replace('\\', '')
    sheet.worksheet(name).insert_row(row, 2)
Exemplo n.º 3
0
    def getData(self):
        billReq = "https://api.propublica.org/congress/v1/" + str(
            self.congress) + "/bills/" + str(self.billSlug) + ".json"

        billData = requests.get(billReq, headers=config.auth())
        self.data = json.loads(billData.text)
        try:
            self.name = self.data['results'][0]['short_title']
        except:
            print(self.data)
Exemplo n.º 4
0
 def getVotes(self):
     self.positions = []
     self.votes = []
     self.voteDates = []
     try:
         for i in range(len(self.data['results'][0]['votes'])):
             voteReq = self.data['results'][0]['votes'][i]['api_url']
             voteData = requests.get(voteReq, headers=config.auth())
             self.votes.append(json.loads(voteData.text))
             self.positions.append(
                 self.votes[i]['results']['votes']['vote']['positions'])
             self.voteDates.append(
                 self.votes[i]['results']['votes']['vote']['date'])
     except:
         print('No votes set')
Exemplo n.º 5
0
def create_list(url, name):
    try:
        creds = auth()
        gc = gspread.authorize(creds)

        spread_sheet = gc.open_by_url(url)
        if name[0] == '%':
            name = 'Info data  '
        name = name + ' '
        date = str(datetime.datetime.today().strftime("%m.%d %H.%M.%S"))
        for i in date:
            if i == ":":
                i = '.'
            if i == "/":
                i = '.'
            name = name + i
        spread_sheet.worksheet('template').duplicate(insert_sheet_index=0,
                                                     new_sheet_name=name)
        return name
    except:
        print('Сделай лист с template в таблице по адресу: ', url)
Exemplo n.º 6
0
    def change(self):
        oldPass = self.opassBox.text()
        newPass = self.npassBox.text()
        repetPass = self.rpassBox.text()
        self.deleteErrorMsg()

        from ConfigParser import NoSectionError
        import config as config
        try:
            auth = config.auth(oldPass)
        except NoSectionError :
            auth = True
        if not auth and not self.firstTime:
            self.err = QtGui.QLabel("<font color=\"red\"> Authentication failure</font>")
            self.gridLayout.addWidget(self.err, 4, 1, 1, 1)
            return
        elif newPass != repetPass :
            self.err = QtGui.QLabel("<font color=\"red\"> Password did not match </font>")
            self.gridLayout.addWidget(self.err, 4, 1, 1, 1)
            return
        config.setPassword(newPass)    
        self.accept()
Exemplo n.º 7
0
def delete(html):
    creds = auth()
    gc = gspread.authorize(creds)
    sheet = gc.open_by_url(html).sheet1
    while sheet.row_values(2) != []:
        sheet.delete_row(2)
Exemplo n.º 8
0
import config
import tweepy

auth = config.auth()

credential = tweepy.OAuthHandler(auth["API"], auth["API_SECRET"])
credential.set_access_token(auth["TOKEN"], auth["TOKEN_SECRET"])

api = tweepy.API(credential, wait_on_rate_limit=True)

while(True):
    try:
        for tweet in tweepy.Cursor(
                api.search, q="#100DaysOfCode", count=1, lang="en", since="2019-11-13").items():
            api.create_favorite(tweet.id)
    except Exception:
        print('Exception')
Exemplo n.º 9
0
 def login(self):
     password = self.passBox.text()
     if config.auth(password) :
         self.accept()
     self.passBox.setText("")