Beispiel #1
0
def __main__():
    def get_content():
        try:
            return open(FILE)
        except FileNotFoundError as e:
            resp = requests.get(URL)
            f = open(FILE, 'wb')
            f.write(resp.content)
            print(resp.content)
            f.close()
            return resp.content
        return None

    c = get_content()
    soup = bs4.BeautifulSoup(get_content(), "lxml")
    lis = soup.select('ul#container > li')
    events = [li_to_event(li) for li in lis]
    c = UnscrollClient()

    #    W3C Web Standards
    TITLE = 'W3C Web Standards'
    favthumb = c.cache_thumbnail(
        'https://2.bp.blogspot.com/-70GFD8HsG3I/VMKLC7IoiBI/AAAAAAAAIck/GCu0LIY3PCU/s1600/Logo%2BW3C.png'
    )
    c.delete_scroll_with_title(TITLE)
    c.__batch__(scroll_title=TITLE, thumbnail=favthumb['url'], events=events)
    print(len(events))
Beispiel #2
0
def __main__():
    events = []
    title = 'IETF RFCs'
    c = UnscrollClient()
    c.delete_scroll_with_title('IETF RFCs')
    favthumb = c.cache_thumbnail(
        'https://ietf.org/media/images/ietf-logo.original.png')

    # Load RFCs
    read = ''
    with open('cache/rfc/rfc-index.xml', 'r') as f:
        read = f.read()
    parsed = xmltodict.parse(read)
    docs = parsed['rfc-index']['rfc-entry']
    events = [rfc_to_event(x) for x in docs]

    # Do it
    scroll = c.__batch__(scroll_title=title,
                         thumbnail=favthumb['url'],
                         events=events)
    print(len(events))