Skip to content

Instantly share code, notes, and snippets.

@wvengen
wvengen / scrapy_h2_proxy.py
Last active October 26, 2023 16:17
Scrapy download handler for HTTP/2 over a HTTP/1 proxy (TLS only).
"""
Download handler for HTTP/2 supporting proxy CONNECT over HTTP/1.
You can use this by configuring it in the spider settings:
DOWNLOAD_HANDLERS = {
'https': 'scrapy_h2_proxy.H2DownloadHandler',
}
Tested with Scrapy 2.5.0.
@wvengen
wvengen / parse_xml_streaming.rb
Last active July 11, 2023 18:48
Parsing an XML stream from an HTTP endpoint in Ruby.
#!/usr/bin/env ruby
#
# Example of parsing a remote XML stream.
#
# Fetches data from an HTTP endpoint, and processes it bit by bit, without
# loading the whole file into memory.
#
# This example shows recent articles from the W3C blog feed.
#
require 'nokogiri'