GithubHelp home page GithubHelp logo

vfaronov / httpolice Goto Github PK

View Code? Open in Web Editor NEW
937.0 11.0 20.0 1.65 MB

Validator for HTTP

License: Other

Python 96.53% CSS 1.51% JavaScript 1.62% Shell 0.34%
http standards rest qa validator lint testing

httpolice's People

Contributors

bmwiedemann avatar jayvdb avatar jwilk avatar vfaronov avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

httpolice's Issues

Best way to integrate with a Node.js stack, "on demand"

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.

test_from_file tests fail

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.

Fedora dependencies for HTTPolice

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

setup.py: Pin lxml version to 3.6.0

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.