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!
Example
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('http://python.org')
# 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):
print(data[0])
# Creates a macro that uses a css selector
@macro.css_selector('#about', first=True)
def foo1(data):
print(data.text)
@macro.xpath('//a', first=True)
def foo2(data):
print(data)
while True:
macro.parse()
sleep(30)
macro.response = session.get('http://python.org')
To Install
$ pip install requests-html-macro
Metadata
Release files for requests-html-macros 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| requests-html-macros-0.1.1.tar.gz | 4.0 kB | Without provenance | Details for requests-html-macros-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| requests_html_macros-0.1.1-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details for requests_html_macros-0.1.1-py2.py3-none-any.whl |
Total release size: 8.7 kB
Release files / requests-html-macros-0.1.1.tar.gz
| Download URL | requests-html-macros-0.1.1.tar.gz |
|---|---|
| Size | 4.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
349a57531fee52d14102ef99f28e62f561f7838da2e9f23342ea9460464f710b
|
|
BLAKE2b-256 checksum How to use checksums |
8fd10154f1745506f6c3782ffafbb29825c8b6d7ac1dffc6775a406e86a870c9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / requests_html_macros-0.1.1-py2.py3-none-any.whl
| Download URL | requests_html_macros-0.1.1-py2.py3-none-any.whl |
|---|---|
| Size | 4.8 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
c9628a7eb18876c9d385616cfd7936cedd99cc46e48aec4861a9ac49a2775578
|
|
BLAKE2b-256 checksum How to use checksums |
2cfab71ab1dd9cec15e0db4f68f77372a536ad0a4d1477590cf3b0bd904dbff8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for requests-html-macros 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.