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


Python DataBase.unsentInformation_delete方法代码示例

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


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

示例1: send_info

# 需要导入模块: import DataBase [as 别名]
# 或者: from DataBase import unsentInformation_delete [as 别名]
def send_info(s, lst, sub, text, q):
    # q is Queue()
    url = 'http://webmail.fil.bg.ac.rs/src/'
    global current_info
    global glst
    global subject
    global body

    glst = list(lst)
    subject = sub
    body = text

    # list consists of tuples with one element, e.g. ([email protected], )
    for i in glst:
        q.put_nowait(1)
        recipient = i[0]

        mail_signature = "\nS poštovanjem,\nMilan Todorović\n\nBiblioteka Katedre za germanistiku\nFilološki fakultet\n" \
                "Univerzitet u Beogradu\nStudentski trg 3\nTel: 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+mail_signature),
                     "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)
            n = [i[0] for i in glst if i[0] not in current_info]
            q.put_nowait(n)
            q.put_nowait(sub)
            q.put_nowait(text)
            q.close()

        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('Info successfully sent.')
        current_info.append(i[0])
        DataBase.unsentInformation_delete(i[0], sub)
    q.put_nowait(0)
    q.close()
    current_info = []
    glst = []
    body = None
    subject = None

    return 0
开发者ID:MilanTodorovic,项目名称:LibraryProject,代码行数:78,代码来源:Sending.py


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