Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (
Help us improve Python packaging - Donate today!

HTML Parsing Macro things for Humans.

Project Description

Requests-Html-Macros is a little sugar on top of an already great html parseing library Requests-Html

This library aims to help make parsing the web a bit easier than it already is with Requests-Html! Create macros that can be reused over different web sites/sessions! Could you do this by hand with requests-html, yes probably pretty simply, but I only realized that liek half way through developing this library and then was just like screw it let’s push it out anyways!


from time import sleep

from requests_html_macro import Macro
from requests_html import HTMLSession

# Create a standard requests-html session
session = HTMLSession()
response = session.get('')

# Create a macro with the response
macro = Macro(response=response)

# Create a macro that uses the parse library to search through the html
@macro.search_pattern('Python is a {} language', first=True)
def foo(data):

# Creates a macro that uses a css selector
@macro.css_selector('#about', first=True)
def foo1(data):

@macro.xpath('//a', first=True)
def foo2(data):

while True:
    macro.response = session.get('')

To Install

$ pip install requests-html-macro

Release History

This version
History Node


History Node


Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, Size & Hash SHA256 Hash Help File Type Python Version Upload Date
(4.8 kB) Copy SHA256 Hash SHA256
Wheel py2.py3 Mar 13, 2018
(4.0 kB) Copy SHA256 Hash SHA256
Source None Mar 13, 2018

Supported By

Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Google Google Cloud Servers DreamHost DreamHost Log Hosting