Commit Graph

229 Commits

Author SHA1 Message Date
Abhinav Singh c6c09395f9
Share lock to acceptors via pool (#238)
* Move manager initialization outside of top level scope.  Fixes #233

* Share lock to acceptor via pool
2019-12-20 15:13:46 -08:00
Abhinav Singh 625dc4d3e5
Move manager initialization outside of top level scope. Fixes #233 (#236) 2019-12-20 14:01:26 -08:00
pyup.io bot fdf0cc557f Update mypy from 0.760 to 0.761 (#235) 2019-12-20 13:10:52 -08:00
pyup.io bot 71a747134c Update mypy from 0.750 to 0.760 (#232) 2019-12-18 07:44:30 -08:00
pyup.io bot fee3af978f Update coverage from 4.5.4 to 5.0 (#230) 2019-12-14 13:14:42 -08:00
pyup.io bot 59325aefc2 Update pytest from 5.3.1 to 5.3.2 (#229) 2019-12-14 08:48:40 -08:00
Abhinav Singh ba5c84dfbd
Proxy Pool Plugin (#228)
* Add proxy pool example. See #226

* Add ProxyPoolPlugin to doc
2019-12-09 19:38:49 -08:00
pyup.io bot e9dfc53f2c Update paramiko from 2.7.0 to 2.7.1 (#227) 2019-12-09 16:45:23 -08:00
pyup.io bot 2f21dea957 Update paramiko from 2.6.0 to 2.7.0 (#225) 2019-12-04 10:50:51 -08:00
pyup.io bot 169d4901c3 Update tox from 3.14.1 to 3.14.2 (#221) 2019-12-03 11:10:17 -08:00
Abhinav Singh ccaf868921
Response parser now reaches COMPLETE even when no body is expected (#220)
* Stash current changes

* Refactor into connection module

* Response parser state complete when no body expect

* Raise NotImplementedError if invalid state reached within parser
2019-12-02 19:18:43 -08:00
Abhinav Singh 269484df2e
Make HTTP handler constructor free of socket file number (#219)
* Refactor into acceptor module

* Add tunnel doc

* Make fileno free

* Autopep8
2019-12-02 15:55:08 -08:00
Abhinav Singh cc7e4f5cbf
No need of per day or week stats (#218) 2019-12-02 10:13:25 -08:00
Abhinav Singh 8971f82f82
Enable mccabe (#217) 2019-12-02 10:04:27 -08:00
Abhinav Singh 5e714374af
Handle ETIMEDOUT, EHOSTUNREACH, ECONNRESET on no internet (#216)
* Catch TimeoutError and OSError (host unreachable)

* Handle ETIMEDOUT, EHOSTUNREACH, ECONNRESET
2019-12-02 00:08:15 -08:00
Abhinav Singh 7f9ffad6d4
Move homebrew under helper (#215) 2019-12-01 23:28:46 -08:00
Abhinav Singh 419026dcdf
Build docker of Python 3.8 (#214) 2019-12-01 23:06:50 -08:00
Abhinav Singh 6137fd6f82
Refactor (#213)
* Add DEFAULT_HTTP_PORT constant

* Use DEFAULT_HTTP_PORT in tests

* Refactor into exception module

* Refactor into inspector module

* Refactor into server module

* Refactor into proxy module
2019-12-01 22:46:00 -08:00
Abhinav Singh 64192250ee
Remove public folder references (#212) 2019-12-01 21:30:29 -08:00
Abhinav Singh fff914e22b
Add support for regex based routing. Fixes #203 (#211) 2019-12-01 20:57:05 -08:00
Abhinav Singh 54d2a1cc32
Packaging (#210)
* Move docker installation steps above

* Try brewing with virtualenv

* depends on python

* Update homebrew formula for stable release

* Just test brewing on latest python
2019-12-01 20:08:50 -08:00
Abhinav Singh 4713ad6ea7
Homebrew formula (#209)
* Add homebrew formula

* Build PyPi package and Homebrew installation verification

* Check develop

* bdist_wheel reported as error: invalid command "bdist_wheel"

* Move under stable/develop folders to keep Proxy class name same

* uff

* develop installs proxy not proxy.py binary

* Prepend site-packages

* Install typing-extensions explicitly with brew

* Use find_packages

* Most likely failing due to lack of find_packages in current develop branch

* Fix windows setup.py build

* test_static_web_server_serves seems flaky on Ubuntu python 3.8

* Add instructions to install using homebrew

* Disable test_static_web_server_serves on GitHub actions, seems flaky
2019-12-01 19:01:28 -08:00
Abhinav Singh 3bd61e0389
Add tox.ini (#208) 2019-12-01 12:57:21 -08:00
pyup.io bot 35ce5fe03a Update setuptools from 42.0.1 to 42.0.2 (#207) 2019-12-01 10:49:26 -08:00
Abhinav Singh bfbbc5a82a
Test Dashboard backend (#206)
* Update shortlink gif name

* Conditionally run workflows as necessary

* Use pytest

* It works but github workflow is not reporting any status :(

* Separate out badges

* Add python_requires to setup.py
2019-11-30 22:54:20 -08:00
Abhinav Singh 654696d2f9
Test Core Eventing (#205)
* Add core event tests

* Update .gitignore with coverage

* Add shortlink gif

* Add event dispatcher test

* Test event subscriber
2019-11-30 22:04:43 -08:00
Abhinav Singh dc1d5b68e7
update mypy to 0.750 (#204) 2019-11-30 19:53:13 -08:00
Abhinav Singh 6f4fe34d65
Add proxy over ssh tunnel functionality (#198) 2019-11-30 09:03:23 -08:00
Abhinav Singh b88d480cdd
Add reverse proxy example (#201)
* Add reverse proxy example

* Add separate sections for http proxy and web server plugins

* Add doc
2019-11-29 21:28:31 -08:00
pyup.io bot 81bf006a7f Update twine from 3.1.0 to 3.1.1 (#200) 2019-11-28 08:41:45 -08:00
pyup.io bot c6da3324e0 Update pytest from 5.3.0 to 5.3.1 (#197) 2019-11-27 09:32:54 -08:00
Abhinav Singh ae92adc432
autopep8 (#196)
* autopep8

* Update TestCase section
2019-11-26 22:43:05 -08:00
Abhinav Singh c9ce446440
Add py3.8 support and bump node to 12.x (#195)
* Add py3.8 support and bump node to 12.x

* Add 10.x, 11.x, 12.x matrix for dashboard testing

* Add Python 3.8 support label

* Single tested with label
2019-11-26 21:44:20 -08:00
Abhinav Singh 35a88c0235
Cleanup (#194)
* Add basic README description for dashboard

* Use spaces for all except makefile

* enable tests for py 3.5

* Python 3.5 support label

* Avoid clash of names
2019-11-26 21:16:08 -08:00
Abhinav Singh 093e852df5
Make connection queue / recv work with memoryview to avoid copies (#192)
* connection.recv now returns a memoryview

* Make connection.queue also memoryview compliant

* autopep8

* wrap in memoryview as necessary

* Add default timeout for socket_connection and test_embed urllib

* Fix tests

* Skip TestProxyPyEmbedded for now, verifying GitHub actions

* Add timeout for wait_for_server and skip only if GITHUB_ACTIONS env variable is set

* Verify if GitHub Action fails due to wait_for_server spinning forever

* Add test for wait_for_server timeout error exception

* GitHub action hangs irrespective of wait_for_server timeout, disable TestEmbed for GitHub actions
2019-11-26 17:59:26 -08:00
pyup.io bot f2b9a632bc Update setuptools from 42.0.0 to 42.0.1 (#193) 2019-11-25 11:22:01 -08:00
Abhinav Singh 9767010425
Memory optimizations (#189)
* Avoid persisting raw content in memory within parser, simply parse and throw-away. Addresses #187

* Clarity in test comments
2019-11-24 11:59:41 -08:00
pyup.io bot 4fa4b99476 Update setuptools from 41.6.0 to 42.0.0 (#191) 2019-11-24 09:38:15 -08:00
pyup.io bot 81e2c89afb Update twine from 3.0.0 to 3.1.0 (#190) 2019-11-24 03:55:41 -08:00
Abhinav Singh e03cae30d2
Initialize Menubar (#188)
* Initialize MacOS Menubar application

* Dashboard plugin at-least needs a shutdown hook to teardown any thread/processes started by dashboard backend plugin

* Add menu bar icon

* Add respective test directories

* Sync test banners

* Move plugin tests under its own package

* Enable daemon for threads, other this wont shutdown cleanly
2019-11-22 15:18:01 -08:00
Abhinav Singh 0c4e1cbda9
Testing support improvements (#185)
* Introduce proxy.Proxy context manager.

This is similar to already existing context manager `start` but
`proxy.Proxy` is a class with __enter__ and __exit__ methods. This
allows usage of `proxy.Proxy` both as context manager and for manually
setup and teardown of `proxy.py` during test setUpClass and
teardownClass methods.

* Gracefully shutdown threadless processes

* Update tests and add a VCR method. See #184

* Refactor routes

* Add Proxy to __all__

* Move TestCase under proxy.testing and test_embed.py under tests.embed module to avoid conflict with http module due to a http directory under proxy folder

* Add a base cache plugin class which can be customized for custom cache behaviors

* See #184. Add VCRPlugin which can be enabled within tests using a context manager, e.g. with self.vcr(): ...

* Make cache plugin pluggable + make cache storage pluggable

* Make dashboard npm module agnostic of top level directory

* Symlink dashboard public folder

* Dump devtools within dashboard public folder

* Remove unused 3rd party js
2019-11-21 21:16:01 -08:00
pyup.io bot dace059617 Update pytest from 5.2.4 to 5.3.0 (#186) 2019-11-20 10:14:35 -08:00
pyup.io bot 5ead1ef101 Update twine from 2.0.0 to 3.0.0 (#183) 2019-11-18 22:01:49 -08:00
Abhinav Singh ad42e0d74d
Doc & Banner update to match GitHub (#182)
* Update doc and banner

* Update banner to match GitHub

* Update older banners too

* Add update_desc to .gitignore

* Update banner for dashboard to match github

* also update html, js, css
2019-11-18 20:45:51 -08:00
pyup.io bot 6aed912554 Update pytest from 5.2.3 to 5.2.4 (#180) 2019-11-15 23:50:42 -08:00
Abhinav Singh bb7006b67a
Move benchmark module within proxy (#181)
* Move benchmark within proxy module

* chmod 0644 for benchmark.py which was executable till now

* Turn utilities into its own section
2019-11-15 23:49:51 -08:00
Abhinav Singh 131e9366ac
Move plugin_examples/ as proxy.plugin and update readme (#179)
* Update dev guide

* Move plugin_examples/ as proxy.plugin

* Update proxy.plugin ref path in readme

* Remove unnecessary port flag

* Remove plugin_examples from github workflows

* dashboard folder is a npm package not python package anymore

* Plugins can now be tried using Docker image
2019-11-15 14:47:50 -08:00
Abhinav Singh 148c260472
Move dashboard backend within proxy module, now ships via same pip package (#177)
* Allow resources to load from http and ws when running w/o https

* Move dashboard backend (dashboard.py) within proxy module. Now shipped with pip install proxy.py

* Update ref to dashboard backend in github workflows

* Add git-pre-commit hook file.

Enable it by symlinking as .git/hooks/pre-commit

* Also enable static server for dashboard serving
2019-11-15 13:29:48 -08:00
Abhinav Singh 439d58fdc2
Devtools Protocol (#174)
* Refine docs

* Decouple relay from dashboard.

Will be re-used by devtools protocol plugin.

* Just have a single manager for all eventing

* Ofcourse managers cant be shared across processes

* Remove unused

* Add DevtoolsProtocolPlugin

* Emit REQUEST_COMPLETE core event

* Emit only if --enable-events used

* Add event emitter for response cycle

* Fill up core events to devtools protocol expectations

* Serve static content with Cache-Control header and gzip compression

* Add PWA manifest.json and icons from sample PWA apps (replace later)

* Catch any exception and be ssl agnostic

* Add CSP headers and avoid inline scripts

* Re-enable iframe and deobfuscation

* Embed plugins within <section/> block

* Make tab switching agnostic of block name

* Add support for browser history on tab change

* Default hash to #home

* Switch to tab if hash is already set

* Expand canvas to fill screen even without content

* Remove inline css for embedded devtools

* Make dashboard backend websocket API pluggable

* doc
2019-11-14 19:00:07 -08:00
Abhinav Singh c943dd7e27
Allow to pass flags as kwargs too in embed mode (#172)
* Dynamically load devtools instead of on page load

* Add support for passing flags as kwargs to main / start methods.

* Fix tests for refactored code

* Allow proxy.main, proxy.start, proxy.TestCase.

Also update README.md to reflect the same.

* Use Any for **opts

* Move main as __init__ to avoid name conflicts

* Fix tests

* Update setup.py entry_point

* Explicitly install requirements before setup.py

* Explicitly mention packages of interest

* ipv6 fails on ubuntu, use ipv4

* Make typing-extensions optional

* Instead of putting it all under __init__.py, move main.py to proxy.py

* Simply make setup.py module free

* autopep8
2019-11-13 16:38:59 -08:00