Skip to content

Instantly share code, notes, and snippets.

@stummjr
stummjr / BSTNode.py
Last active April 27, 2024 23:38
BSTNode.py - Binary Search Tree
# -*- encoding:utf-8 -*-
from __future__ import print_function
class BSTNode(object):
def __init__(self, key, value=None, left=None, right=None):
self.key = key
self.value = value
self.left = left
@stummjr
stummjr / splash-spider.py
Last active June 6, 2018 16:22
Scrapy + Splash example
import scrapy
# this example needs the scrapyjs package: pip install scrapyjs
# it also needs a splash instance running in your env or on Scrapy Cloud (https://github.com/scrapinghub/splash)
class SplashSpider(scrapy.Spider):
name = 'splash-spider'
download_delay = 3
def start_requests(self):
# -*- coding:utf-8 -*-
import scrapy
from scrapy.exceptions import CloseSpider
class LoginSpider(scrapy.Spider):
name = 'login-spider'
start_urls = ['http://quotes.toscrape.com/login']
def parse(self, response):