vfaronov / httpolice Goto Github PK
View Code? Open in Web Editor NEWValidator for HTTP
License: Other
Validator for HTTP
License: Other
It would be nice if this library supported both of the brotli libraries, so the user can have either one installed.
c.f. python-hyper/brotlicffi#145 and python-hyper/brotlicffi#149
This is a great project!! Just a quick question.
What are your advice in integrating a linting process of HTTP traffic (with a nodejs stack) ?? Is this a bad idea to always have it running, while developiing ??
If not a bad idea, would simply using "mitmproxy" running constantly the best way to go ?
Thanks for feedback.
When packaging this package for openSUSE/Tumbleweed, test suite fails in the calls to test_from_file
tests:
[ 14s] =================================== FAILURES ===================================
[ 14s] ____________________ test_from_file[combined_data/silence3] ____________________
[ 14s]
[ 14s] self = <defusedxml.ElementTree.DefusedXMLParser object at 0x7f523a776208>
[ 14s] data = b'Hello world!\r\n'
[ 14s]
[ 14s] def feed(self, data):
[ 14s] """Feed encoded data to parser."""
[ 14s] try:
[ 14s] > self.parser.Parse(data, 0)
[ 14s] E xml.parsers.expat.ExpatError: syntax error: line 1, column 0
[ 14s]
[ 14s] /usr/lib64/python3.6/xml/etree/ElementTree.py:1624: ExpatError
[ 14s]
[ 14s] During handling of the above exception, another exception occurred:
[ 14s]
[ 14s] input_from_file = ([Exchange(<Request GET>, [<Response 200>])], [1039])
[ 14s]
[ 14s] def test_from_file(input_from_file): # pylint: disable=redefined-outer-name
[ 14s] (exchanges, expected) = input_from_file
[ 14s] for exch in exchanges:
[ 14s] > check_exchange(exch)
[ 14s]
[ 14s] test/test_from_files.py:48:
[ 14s] _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
[ 14s] ../../BUILDROOT/python-HTTPolice-0.9.0-0.x86_64/usr/lib/python3.6/site-packages/httpolice/exchange.py:65: in check_exchange
[ 14s] response.check_responses(exch.responses)
[ 14s] ../../BUILDROOT/python-HTTPolice-0.9.0-0.x86_64/usr/lib/python3.6/site-packages/httpolice/response.py:215: in check_responses
[ 14s] check_response(resp)
[ 14s] ../../BUILDROOT/python-HTTPolice-0.9.0-0.x86_64/usr/lib/python3.6/site-packages/httpolice/response.py:220: in check_response
[ 14s] check_response_itself(resp)
[ 14s] ../../BUILDROOT/python-HTTPolice-0.9.0-0.x86_64/usr/lib/python3.6/site-packages/httpolice/response.py:229: in check_response_itself
[ 14s] message.check_message(resp)
[ 14s] ../../BUILDROOT/python-HTTPolice-0.9.0-0.x86_64/usr/lib/python3.6/site-packages/httpolice/message.py:280: in check_message
[ 14s] _ = msg.xml_data
[ 14s] ../../BUILDROOT/python-HTTPolice-0.9.0-0.x86_64/usr/lib/python3.6/site-packages/httpolice/blackboard.py:105: in prop
[ 14s] self.memoized[getter.__name__] = getter(self)
[ 14s] ../../BUILDROOT/python-HTTPolice-0.9.0-0.x86_64/usr/lib/python3.6/site-packages/httpolice/message.py:152: in xml_data
[ 14s] return defusedxml.ElementTree.fromstring(self.decoded_body)
[ 14s] /usr/lib/python3.6/site-packages/defusedxml/common.py:126: in fromstring
[ 14s] parser.feed(text)
[ 14s] /usr/lib64/python3.6/xml/etree/ElementTree.py:1626: in feed
[ 14s] self._raiseerror(v)
[ 14s] _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
[ 14s]
[ 14s] self = <defusedxml.ElementTree.DefusedXMLParser object at 0x7f523a776208>
[ 14s] value = ExpatError('syntax error: line 1, column 0',)
[ 14s]
[ 14s] def _raiseerror(self, value):
[ 14s] err = ParseError(value)
[ 14s] err.code = value.code
[ 14s] err.position = value.lineno, value.offset
[ 14s] > raise err
[ 14s] E File "<string>", line None
[ 14s] E xml.etree.ElementTree.ParseError: syntax error: line 1, column 0
[ 14s]
[ 14s] /usr/lib64/python3.6/xml/etree/ElementTree.py:1525: ParseError
[ 14s] _____________________ test_from_file[combined_data/1039_1] _____________________
[ 14s]
[ 14s] self = <defusedxml.ElementTree.DefusedXMLParser object at 0x7f523a77dfd0>
[ 14s] data = b'<doc>\r\n <item type=text>Hello world!</item>\r\n</doc>\r\n'
[ 14s]
[ 14s] def feed(self, data):
[ 14s] """Feed encoded data to parser."""
[ 14s] try:
[ 14s] > self.parser.Parse(data, 0)
[ 14s] E xml.parsers.expat.ExpatError: not well-formed (invalid token): line 2, column 13
[ 14s]
[ 14s] /usr/lib64/python3.6/xml/etree/ElementTree.py:1624: ExpatError
[ 14s]
[ 14s] During handling of the above exception, another exception occurred:
[ 14s]
[ 14s] input_from_file = ([Exchange(<Request GET>, [<Response 200>])], [1039])
[ 14s]
[ 14s] def test_from_file(input_from_file): # pylint: disable=redefined-outer-name
[ 14s] (exchanges, expected) = input_from_file
[ 14s] for exch in exchanges:
[ 14s] > check_exchange(exch)
[ 14s]
[ 14s] test/test_from_files.py:48:
[ 14s] _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
[ 14s] ../../BUILDROOT/python-HTTPolice-0.9.0-0.x86_64/usr/lib/python3.6/site-packages/httpolice/exchange.py:65: in check_exchange
[ 14s] response.check_responses(exch.responses)
[ 14s] ../../BUILDROOT/python-HTTPolice-0.9.0-0.x86_64/usr/lib/python3.6/site-packages/httpolice/response.py:215: in check_responses
[ 14s] check_response(resp)
[ 14s] ../../BUILDROOT/python-HTTPolice-0.9.0-0.x86_64/usr/lib/python3.6/site-packages/httpolice/response.py:220: in check_response
[ 14s] check_response_itself(resp)
[ 14s] ../../BUILDROOT/python-HTTPolice-0.9.0-0.x86_64/usr/lib/python3.6/site-packages/httpolice/response.py:229: in check_response_itself
[ 14s] message.check_message(resp)
[ 14s] ../../BUILDROOT/python-HTTPolice-0.9.0-0.x86_64/usr/lib/python3.6/site-packages/httpolice/message.py:280: in check_message
[ 14s] _ = msg.xml_data
[ 14s] ../../BUILDROOT/python-HTTPolice-0.9.0-0.x86_64/usr/lib/python3.6/site-packages/httpolice/blackboard.py:105: in prop
[ 14s] self.memoized[getter.__name__] = getter(self)
[ 14s] ../../BUILDROOT/python-HTTPolice-0.9.0-0.x86_64/usr/lib/python3.6/site-packages/httpolice/message.py:152: in xml_data
[ 14s] return defusedxml.ElementTree.fromstring(self.decoded_body)
[ 14s] /usr/lib/python3.6/site-packages/defusedxml/common.py:126: in fromstring
[ 14s] parser.feed(text)
[ 14s] /usr/lib64/python3.6/xml/etree/ElementTree.py:1626: in feed
[ 14s] self._raiseerror(v)
[ 14s] _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
[ 14s]
[ 14s] self = <defusedxml.ElementTree.DefusedXMLParser object at 0x7f523a77dfd0>
[ 14s] value = ExpatError('not well-formed (invalid token): line 2, column 13',)
[ 14s]
[ 14s] def _raiseerror(self, value):
[ 14s] err = ParseError(value)
[ 14s] err.code = value.code
[ 14s] err.position = value.lineno, value.offset
[ 14s] > raise err
[ 14s] E File "<string>", line None
[ 14s] E xml.etree.ElementTree.ParseError: not well-formed (invalid token): line 2, column 13
[ 14s]
[ 14s] /usr/lib64/python3.6/xml/etree/ElementTree.py:1525: ParseError
[ 14s] _________________ test_from_file[combined_data/showcase.https] _________________
[ 14s]
[ 14s] self = <defusedxml.ElementTree.DefusedXMLParser object at 0x7f523a9f42e8>
[ 14s] data = b'<?xml version="1.0"?>\n<article>\n <title>The Rise & Fall of Lorem Ipsum</title>\n <text align="left">\n Lorem ...ontes, nascetur ridiculus mus. Vestibulum vel mi molestie, aliquam turpis et, elementum elit.\n </text>\n</article>\n'
[ 14s]
[ 14s] def feed(self, data):
[ 14s] """Feed encoded data to parser."""
[ 14s] try:
[ 14s] > self.parser.Parse(data, 0)
[ 14s] E xml.parsers.expat.ExpatError: not well-formed (invalid token): line 3, column 19
[ 14s]
[ 14s] /usr/lib64/python3.6/xml/etree/ElementTree.py:1624: ExpatError
[ 14s]
[ 14s] During handling of the above exception, another exception occurred:
[ 14s]
[ 14s] input_from_file = ([Exchange(<Request PUT>, [<Response 406>])], [1000, 1000, 1039, 1063, 1090, 1093, ...])
[ 14s]
[ 14s] def test_from_file(input_from_file): # pylint: disable=redefined-outer-name
[ 14s] (exchanges, expected) = input_from_file
[ 14s] for exch in exchanges:
[ 14s] > check_exchange(exch)
[ 14s]
[ 14s] test/test_from_files.py:48:
[ 14s] _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
[ 14s] ../../BUILDROOT/python-HTTPolice-0.9.0-0.x86_64/usr/lib/python3.6/site-packages/httpolice/exchange.py:62: in check_exchange
[ 14s] request.check_request(exch.request)
[ 14s] ../../BUILDROOT/python-HTTPolice-0.9.0-0.x86_64/usr/lib/python3.6/site-packages/httpolice/request.py:213: in check_request
[ 14s] message.check_message(req)
[ 14s] ../../BUILDROOT/python-HTTPolice-0.9.0-0.x86_64/usr/lib/python3.6/site-packages/httpolice/message.py:280: in check_message
[ 14s] _ = msg.xml_data
[ 14s] ../../BUILDROOT/python-HTTPolice-0.9.0-0.x86_64/usr/lib/python3.6/site-packages/httpolice/blackboard.py:105: in prop
[ 14s] self.memoized[getter.__name__] = getter(self)
[ 14s] ../../BUILDROOT/python-HTTPolice-0.9.0-0.x86_64/usr/lib/python3.6/site-packages/httpolice/message.py:152: in xml_data
[ 14s] return defusedxml.ElementTree.fromstring(self.decoded_body)
[ 14s] /usr/lib/python3.6/site-packages/defusedxml/common.py:126: in fromstring
[ 14s] parser.feed(text)
[ 14s] /usr/lib64/python3.6/xml/etree/ElementTree.py:1626: in feed
[ 14s] self._raiseerror(v)
[ 14s] _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
[ 14s]
[ 14s] self = <defusedxml.ElementTree.DefusedXMLParser object at 0x7f523a9f42e8>
[ 14s] value = ExpatError('not well-formed (invalid token): line 3, column 19',)
[ 14s]
[ 14s] def _raiseerror(self, value):
[ 14s] err = ParseError(value)
[ 14s] err.code = value.code
[ 14s] err.position = value.lineno, value.offset
[ 14s] > raise err
[ 14s] E File "<string>", line None
[ 14s] E xml.etree.ElementTree.ParseError: not well-formed (invalid token): line 3, column 19
[ 14s]
[ 14s] /usr/lib64/python3.6/xml/etree/ElementTree.py:1525: ParseError
[ 14s] =========================== short test summary info ============================
[ 14s] FAILED test/test_from_files.py::test_from_file[combined_data/silence3] - Fi...
[ 14s] FAILED test/test_from_files.py::test_from_file[combined_data/1039_1] - File...
[ 14s] FAILED test/test_from_files.py::test_from_file[combined_data/showcase.https]
[ 14s] ======================== 3 failed, 748 passed in 9.02s =========================
[ 14s] error: Bad exit status from /var/tmp/rpm-tmp.AmsEsl (%check)
[ 14s]
Complete build log with all details and versions of used packages.
singledispatch is a backport from Python 3.4, and shouldnt be needed on Python 3.4+.
You have documented the dependencies for Debian/Ubuntu in the install docs
It would be better if you add a row for Fedora users as well. I did a install on Fedora 24
, and had to install the following packages:
python-devel redhat-rpm-config libxml2-devel libxslt-devel
These can be installed on 24
using
$ dnf install python-devel redhat-rpm-config libxml2-devel libxslt-devel
Hey, our project coala-quickstart uses HTTpolice as a dependency.
The recent version of lxml (3.8.0) uses .tar.gz
instead of wheel
, which is causing builds to fail on 64-bit Windows architecture. It'd be great if the lxml
version in setup.py
could be pinned to 3.6.0
which is the last known version by us that used to work.
Build links which are failing: https://ci.appveyor.com/project/coala/coala-quickstart/build/1.0.132/job/rttmk9vcdsq9rl3b
https://ci.appveyor.com/project/coala/coala-quickstart/build/1.0.134/job/e7jbpvs4jcxko07c
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.