selenium-interceptor


Nameselenium-interceptor JSON
Version 1.0.2 PyPI version JSON
download
home_pagehttps://github.com/kaliiiiiiiiii/selenium_interceptor
SummaryIntercept requests using Selenium with Chrome
upload_time2023-01-13 12:15:38
maintainer
docs_urlNone
authorAurin Aegerter
requires_python>=3.7
license
keywords selenium interception proxy webautomation
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Selenium-Interceptor

* Modifying or [adding headers](#Change-headers)
* Modify response

### Feel free to test my code!

## Getting Started

### Dependencies

* [Python >= 3.7](https://www.python.org/downloads/)
* [Chrome-Browser](https://www.google.de/chrome/) installed
* Selenium

### Installing

* [Windows] Install [Chrome-Browser](https://www.google.de/chrome/)
* ```pip install selenium_interceptor```


### Change-headers
```python

from selenium_interceptor.interceptor import cdp_listener

from selenium_profiles import driver as mydriver
from selenium_profiles.profiles import profiles

mydriver = mydriver()
profile = profiles.Windows()

driver = mydriver.start(profile)

cdp_listener = cdp_listener(driver=driver)
cdp_listener.specify_headers({"sec-ch-ua-platform":"Android"})
thread = cdp_listener.start_threaded(listener={"listener": cdp_listener.requests, "at_event": cdp_listener.modify_headers})

driver.get("https://modheader.com/headers?product=ModHeader")
```
Don't forget to execute
`cdp_listener.terminate_all()`
in the End. Else-wise your temporary folder will get flooded! (Windows) and it keeps running

## Help

Please feel free to open an issue or fork!

## Todo



## Deprecated

## Authors

[Aurin Aegerter](mailto:aurinliun@gmx.ch)

## License

Shield: [![CC BY-NC-SA 4.0][cc-by-nc-sa-shield]][cc-by-nc-sa]

This work is licensed under a
[Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License][cc-by-nc-sa].

[![CC BY-NC-SA 4.0][cc-by-nc-sa-image]][cc-by-nc-sa]

[cc-by-nc-sa]: http://creativecommons.org/licenses/by-nc-sa/4.0/
[cc-by-nc-sa-image]: https://licensebuttons.net/l/by-nc-sa/4.0/88x31.png
[cc-by-nc-sa-shield]: https://img.shields.io/badge/License-CC%20BY--NC--SA%204.0-lightgrey.svg

## Disclaimer

I am not responsible what you use the code for!!! Also no warranty!

## Acknowledgments

Inspiration, code snippets, etc.
* [Selenium-Profiles](https://github.com/kaliiiiiiiiii/Selenium-Profiles)
* [Chrome-devtools-protocol](https://chromedevtools.github.io/devtools-protocol/tot/Fetch/#method-enable)
* [cdp_event_listeners](https://stackoverflow.com/questions/66227508/selenium-4-0-0-beta-1-how-add-event-listeners-in-cdp)

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/kaliiiiiiiiii/selenium_interceptor",
    "name": "selenium-interceptor",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": "",
    "keywords": "Selenium,interception,proxy,webautomation",
    "author": "Aurin Aegerter",
    "author_email": "aurinliun@gmx.ch",
    "download_url": "https://files.pythonhosted.org/packages/f2/4a/ec8229dfd7b06363afa49a2dffb3809b080c8f9ebe710e6ae592d5f20f42/selenium_interceptor-1.0.2.tar.gz",
    "platform": null,
    "description": "# Selenium-Interceptor\r\n\r\n* Modifying or [adding headers](#Change-headers)\r\n* Modify response\r\n\r\n### Feel free to test my code!\r\n\r\n## Getting Started\r\n\r\n### Dependencies\r\n\r\n* [Python >= 3.7](https://www.python.org/downloads/)\r\n* [Chrome-Browser](https://www.google.de/chrome/) installed\r\n* Selenium\r\n\r\n### Installing\r\n\r\n* [Windows] Install [Chrome-Browser](https://www.google.de/chrome/)\r\n* ```pip install selenium_interceptor```\r\n\r\n\r\n### Change-headers\r\n```python\r\n\r\nfrom selenium_interceptor.interceptor import cdp_listener\r\n\r\nfrom selenium_profiles import driver as mydriver\r\nfrom selenium_profiles.profiles import profiles\r\n\r\nmydriver = mydriver()\r\nprofile = profiles.Windows()\r\n\r\ndriver = mydriver.start(profile)\r\n\r\ncdp_listener = cdp_listener(driver=driver)\r\ncdp_listener.specify_headers({\"sec-ch-ua-platform\":\"Android\"})\r\nthread = cdp_listener.start_threaded(listener={\"listener\": cdp_listener.requests, \"at_event\": cdp_listener.modify_headers})\r\n\r\ndriver.get(\"https://modheader.com/headers?product=ModHeader\")\r\n```\r\nDon't forget to execute\r\n`cdp_listener.terminate_all()`\r\nin the End. Else-wise your temporary folder will get flooded! (Windows) and it keeps running\r\n\r\n## Help\r\n\r\nPlease feel free to open an issue or fork!\r\n\r\n## Todo\r\n\r\n\r\n\r\n## Deprecated\r\n\r\n## Authors\r\n\r\n[Aurin Aegerter](mailto:aurinliun@gmx.ch)\r\n\r\n## License\r\n\r\nShield: [![CC BY-NC-SA 4.0][cc-by-nc-sa-shield]][cc-by-nc-sa]\r\n\r\nThis work is licensed under a\r\n[Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License][cc-by-nc-sa].\r\n\r\n[![CC BY-NC-SA 4.0][cc-by-nc-sa-image]][cc-by-nc-sa]\r\n\r\n[cc-by-nc-sa]: http://creativecommons.org/licenses/by-nc-sa/4.0/\r\n[cc-by-nc-sa-image]: https://licensebuttons.net/l/by-nc-sa/4.0/88x31.png\r\n[cc-by-nc-sa-shield]: https://img.shields.io/badge/License-CC%20BY--NC--SA%204.0-lightgrey.svg\r\n\r\n## Disclaimer\r\n\r\nI am not responsible what you use the code for!!! Also no warranty!\r\n\r\n## Acknowledgments\r\n\r\nInspiration, code snippets, etc.\r\n* [Selenium-Profiles](https://github.com/kaliiiiiiiiii/Selenium-Profiles)\r\n* [Chrome-devtools-protocol](https://chromedevtools.github.io/devtools-protocol/tot/Fetch/#method-enable)\r\n* [cdp_event_listeners](https://stackoverflow.com/questions/66227508/selenium-4-0-0-beta-1-how-add-event-listeners-in-cdp)\r\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "Intercept requests using Selenium with Chrome",
    "version": "1.0.2",
    "split_keywords": [
        "selenium",
        "interception",
        "proxy",
        "webautomation"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "f24aec8229dfd7b06363afa49a2dffb3809b080c8f9ebe710e6ae592d5f20f42",
                "md5": "fdaa741a34db5bebd0b52a781506a8d1",
                "sha256": "e6410f743484e875d285da6fb9238b825ba76ae4efbbc5c6b9a3a45d2a6c4d39"
            },
            "downloads": -1,
            "filename": "selenium_interceptor-1.0.2.tar.gz",
            "has_sig": false,
            "md5_digest": "fdaa741a34db5bebd0b52a781506a8d1",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 6299,
            "upload_time": "2023-01-13T12:15:38",
            "upload_time_iso_8601": "2023-01-13T12:15:38.926351Z",
            "url": "https://files.pythonhosted.org/packages/f2/4a/ec8229dfd7b06363afa49a2dffb3809b080c8f9ebe710e6ae592d5f20f42/selenium_interceptor-1.0.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-01-13 12:15:38",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "kaliiiiiiiiii",
    "github_project": "selenium_interceptor",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [],
    "lcname": "selenium-interceptor"
}
        
Elapsed time: 0.02733s