当前位置: 首页>>代码示例>>Python>>正文


Python DataBase.unsentWarning_delete方法代码示例

本文整理汇总了Python中DataBase.unsentWarning_delete方法的典型用法代码示例。如果您正苦于以下问题:Python DataBase.unsentWarning_delete方法的具体用法?Python DataBase.unsentWarning_delete怎么用?Python DataBase.unsentWarning_delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DataBase的用法示例。


在下文中一共展示了DataBase.unsentWarning_delete方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: send_warning

# 需要导入模块: import DataBase [as 别名]
# 或者: from DataBase import unsentWarning_delete [as 别名]
def send_warning(s, lst, q, *args):
    # s is the session object
    # q is Queue()
    global current_warning
    global glst
    url = 'http://webmail.fil.bg.ac.rs/src/'

    glst = list(lst)
    subject = 'Kasnjenje'

    # list consists of tuples with multiple element, e.g. ([email protected], author, book...)
    for i in glst:
        q.put_nowait(1)
        recipient=i[0]
        body='Postovani,\n\nKasnite s vracanjem knjige '+str(i[1])+': "'+str(i[2])+'", signatura: '+str(i[3])+' uzete ' \
                ''+str(i[4])+'.\n Rok za vracanje je bio '+str(i[5])+'.\n' \
                'Molim Vas da je vratite u sto kracem roku.\n' \
                'S postovanjem,\n' \
                'Milan Todorovic\n\n' \
                'Biblioteka Katedre za germanistiku\n' \
                'Filoloski fakultet\n' \
                'Univerzitet u Beogradu\nStudentski trg 3\n' \
                'Tel: 011/2021-698\nRadno vreme: 9.00-17.00'

        files = {"startMessage": (None, "1"),
                     "session": (None, "1"),
                     "passed_id": (None, ""),
                     "send_to": (None, recipient),
                     "send_to_cc": (None, ""),
                     "send_to_bcc": (None, ""),
                     "subject": (None, subject),
                     "mailprio": (None, "3"),
                     "body": (None, body),
                     "send": (None, "Send"),
                     "attachfile": ("", ""),
                     "MAX_FILE_SIZE": (None, "20971520"),
                     "username": (None, "milan.todorovic"),
                     "smaction": (None, ""),
                     "mailbox": (None, "INBOX"),
                     "composesession": (None, "1"),
                     "querystring": (None, "mailbox=INBOX&startMessage=1")}

        left_side = url + 'left_main.php'
        right_side = url + 'right_main.php'
        try:
            l = s.get(left_side)
            r = s.get(right_side)
            print('Loading left frame: ', l.status_code)
            print('Loading right frame: ', r.status_code)
        except ConnectionError:
            q.put_nowait(2)
            l = [i for i in glst if i[0] not in current_warning]
            q.put_nowait(l) # returns a list to lst in uppbar()
            q.close()
            # return [i for i in glst if i[0] not in current_warning]


        time.sleep(1)
        compose = url + 'compose.php?mailbox=INBOX&startMessage=1'
        r = s.get(compose)
        print('Enterying "Compose": ', r.status_code)

        send = url + 'compose.php'
        time.sleep(1)
        r = s.post(send, files=files, allow_redirects=False)
        print('Mail sent: ', r.status_code)
        print('Redirecting to: ', r.headers['Location'])
        r = s.get(r.headers['Location'])
        print('Redirected to home page: ', r.status_code)
        print('Warning successfully sent.')
        current_warning.append(i[0])
        DataBase.unsentWarning_delete(i[0])
    q.put_nowait(0)
    q.close()
    current_warning = []
    glst = []
    # returns to variable security
    return 0
开发者ID:MilanTodorovic,项目名称:LibraryProject,代码行数:80,代码来源:Sending.py


注:本文中的DataBase.unsentWarning_delete方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。