requestez


Namerequestez JSON
Version 0.1.5 PyPI version JSON
download
home_pageNone
SummaryA simpler interface for scraping with some basic parsing, aes encryption decryption and some logging utils.
upload_time2024-10-15 17:06:02
maintainerNone
docs_urlNone
authorshashstormer
requires_pythonNone
licenseNone
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # RequestEZ

RequestEZ is a Python library that simplifies web scraping, provides basic parsing utilities, AES encryption/decryption, and some useful logging utilities.

## Installation

You can install RequestEZ using `pip`. Make sure you have Python 3.9 or later installed.

```bash
pip install requestez
```
# Usage
### 1. Basic Web Scraping:
RequestEZ provides a simple interface for making HTTP requests. You can create a session and use it to fetch web pages. 
```python
from requestez import Session
session = Session()
response: str = session.get("https://example.com")  # refer to inline documentation for more options
print(response)
```
### 2. AES Encryption/Decryption:
You can use RequestEZ to perform AES encryption and decryption of data.

```python
from requestez.encryption import aes_enc, aes_dec

key: bytes = b"your_32_byte_secret_key"
iv: bytes = b"your_16_byte_initialization_vector"
data: str = "your_data_to_encrypt"

encrypted_data: str = aes_enc(key, iv, data)
decrypted_data: str = aes_dec(key, iv, encrypted_data)

print("Encrypted:", encrypted_data)
print("Decrypted:", decrypted_data)

# you need to do from requestez.encryption.unpack import PACKER to find and decrypt p.a.c.k.e.r. encrypted data
# read code to find out more
```
### 3. Parsing Utilities:
RequestEZ provides some basic parsing utilities. You can use them to parse HTML, JSON, and XML data.

```python
from requestez.parsers import html, load
html_data = "<html><body><h1>Hello World</h1></body></html>"
json_data = '{"name": "John Doe", "age": 30}'

# Parse HTML data
parsed_html = html(html_data) # returns a BeautifulSoup object

# Parse JSON data
parsed_json = load(json_data) # returns a dict if valid json otherwise returns the string itsef
```
 There are other parsing utilities available as well. Please read the inline documentation for those.
 some of them are 
 - `m3u8_master` for parsing a M3U8 master playlist
 - `m3u8` for parsing M3U8 data > returns `m3u8.parse(playlist)`
 - `reg_replace` basically `re.sub` just don't have to import re
 - `secondsToRead` for converting seconds to human-readable format like `x day(s) x hour(s)...`
 - `secondsToTime` for converting seconds to `(DD):HH:MM:SS` format
 - `stringify` for converting a dict to a string with optional escaping
 - `load` for loading JSON data which can handle escaped json but is iterative to handle escaped json

### 4. Logging Utilities:
RequestEZ provides some useful and colorful logging utilities. You can use them to log data to a file or to the console.

```python
# it works similar to the logging module but with some extra features
# Logging to a file not supported yet
# Color compatibility depends on the terminal
# Works on windows cmd, powershell, and linux terminal (tested) 
# others not tested
import time
from requestez.helpers import log, set_log_level, pbar
set_log_level("debug")
log("Hello World", color="green" ,log_level="debug") # logs hello world
set_log_level("info") # sets log level to debug
log("Hello World", color="green" ,log_level="info") # logs red hello world to console
log("Hello World", color="red" ,log_level="debug") # logs nothing to console
# Refer to inline documentation for more options


progress_printer = pbar(total=10, prefix='Progress:', suffix='', length=35, color="green", unit="seconds")
for i in range(11):
    time.sleep(1)  # Simulate some work
    progress_printer.update(i)
    # it is equivalent to 
    # progress_printer.update(plus=1) -> this is done by default in the tqdm module
# Refer to inline documentation for more options
```
#### the order of level priority is as follows:
 
- priority level (alias)
1. CRITICAL (c)
2. ERROR (e)
3. WARNING (w)
4. INFO (i)
5. DEBUG (d)


            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "requestez",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": null,
    "author": "shashstormer",
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/af/66/291c0689642bbd200b5b668b359971758037aa99f9aa12382713f61ad883/requestez-0.1.5.tar.gz",
    "platform": null,
    "description": "# RequestEZ\r\n\r\nRequestEZ is a Python library that simplifies web scraping, provides basic parsing utilities, AES encryption/decryption, and some useful logging utilities.\r\n\r\n## Installation\r\n\r\nYou can install RequestEZ using `pip`. Make sure you have Python 3.9 or later installed.\r\n\r\n```bash\r\npip install requestez\r\n```\r\n# Usage\r\n### 1. Basic Web Scraping:\r\nRequestEZ provides a simple interface for making HTTP requests. You can create a session and use it to fetch web pages. \r\n```python\r\nfrom requestez import Session\r\nsession = Session()\r\nresponse: str = session.get(\"https://example.com\")  # refer to inline documentation for more options\r\nprint(response)\r\n```\r\n### 2. AES Encryption/Decryption:\r\nYou can use RequestEZ to perform AES encryption and decryption of data.\r\n\r\n```python\r\nfrom requestez.encryption import aes_enc, aes_dec\r\n\r\nkey: bytes = b\"your_32_byte_secret_key\"\r\niv: bytes = b\"your_16_byte_initialization_vector\"\r\ndata: str = \"your_data_to_encrypt\"\r\n\r\nencrypted_data: str = aes_enc(key, iv, data)\r\ndecrypted_data: str = aes_dec(key, iv, encrypted_data)\r\n\r\nprint(\"Encrypted:\", encrypted_data)\r\nprint(\"Decrypted:\", decrypted_data)\r\n\r\n# you need to do from requestez.encryption.unpack import PACKER to find and decrypt p.a.c.k.e.r. encrypted data\r\n# read code to find out more\r\n```\r\n### 3. Parsing Utilities:\r\nRequestEZ provides some basic parsing utilities. You can use them to parse HTML, JSON, and XML data.\r\n\r\n```python\r\nfrom requestez.parsers import html, load\r\nhtml_data = \"<html><body><h1>Hello World</h1></body></html>\"\r\njson_data = '{\"name\": \"John Doe\", \"age\": 30}'\r\n\r\n# Parse HTML data\r\nparsed_html = html(html_data) # returns a BeautifulSoup object\r\n\r\n# Parse JSON data\r\nparsed_json = load(json_data) # returns a dict if valid json otherwise returns the string itsef\r\n```\r\n There are other parsing utilities available as well. Please read the inline documentation for those.\r\n some of them are \r\n - `m3u8_master` for parsing a M3U8 master playlist\r\n - `m3u8` for parsing M3U8 data > returns `m3u8.parse(playlist)`\r\n - `reg_replace` basically `re.sub` just don't have to import re\r\n - `secondsToRead` for converting seconds to human-readable format like `x day(s) x hour(s)...`\r\n - `secondsToTime` for converting seconds to `(DD):HH:MM:SS` format\r\n - `stringify` for converting a dict to a string with optional escaping\r\n - `load` for loading JSON data which can handle escaped json but is iterative to handle escaped json\r\n\r\n### 4. Logging Utilities:\r\nRequestEZ provides some useful and colorful logging utilities. You can use them to log data to a file or to the console.\r\n\r\n```python\r\n# it works similar to the logging module but with some extra features\r\n# Logging to a file not supported yet\r\n# Color compatibility depends on the terminal\r\n# Works on windows cmd, powershell, and linux terminal (tested) \r\n# others not tested\r\nimport time\r\nfrom requestez.helpers import log, set_log_level, pbar\r\nset_log_level(\"debug\")\r\nlog(\"Hello World\", color=\"green\" ,log_level=\"debug\") # logs hello world\r\nset_log_level(\"info\") # sets log level to debug\r\nlog(\"Hello World\", color=\"green\" ,log_level=\"info\") # logs red hello world to console\r\nlog(\"Hello World\", color=\"red\" ,log_level=\"debug\") # logs nothing to console\r\n# Refer to inline documentation for more options\r\n\r\n\r\nprogress_printer = pbar(total=10, prefix='Progress:', suffix='', length=35, color=\"green\", unit=\"seconds\")\r\nfor i in range(11):\r\n    time.sleep(1)  # Simulate some work\r\n    progress_printer.update(i)\r\n    # it is equivalent to \r\n    # progress_printer.update(plus=1) -> this is done by default in the tqdm module\r\n# Refer to inline documentation for more options\r\n```\r\n#### the order of level priority is as follows:\r\n \r\n- priority level (alias)\r\n1. CRITICAL (c)\r\n2. ERROR (e)\r\n3. WARNING (w)\r\n4. INFO (i)\r\n5. DEBUG (d)\r\n\r\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "A simpler interface for scraping with some basic parsing, aes encryption decryption and some logging utils.",
    "version": "0.1.5",
    "project_urls": {
        "GitHub": "https://github.com/shashstormer/requestez"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b4d0c7e2e429cfb900164af97f377eb883e54bc0ac120b48b6f85d3817bf45c4",
                "md5": "a442efcddbb17a68509580d0f5ef091e",
                "sha256": "cf4225660a5ae2438f8c3e798c96f1e4abddd8cc09407681e4a2413025682e86"
            },
            "downloads": -1,
            "filename": "requestez-0.1.5-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "a442efcddbb17a68509580d0f5ef091e",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 19518,
            "upload_time": "2024-10-15T17:06:01",
            "upload_time_iso_8601": "2024-10-15T17:06:01.156961Z",
            "url": "https://files.pythonhosted.org/packages/b4/d0/c7e2e429cfb900164af97f377eb883e54bc0ac120b48b6f85d3817bf45c4/requestez-0.1.5-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "af66291c0689642bbd200b5b668b359971758037aa99f9aa12382713f61ad883",
                "md5": "c5b7af2e05578f459db7dc6e729879cb",
                "sha256": "2ec1621c5e5843e45cf3c356d8683a308b7f1be2757d4f152482e93249ac0df7"
            },
            "downloads": -1,
            "filename": "requestez-0.1.5.tar.gz",
            "has_sig": false,
            "md5_digest": "c5b7af2e05578f459db7dc6e729879cb",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 18662,
            "upload_time": "2024-10-15T17:06:02",
            "upload_time_iso_8601": "2024-10-15T17:06:02.701251Z",
            "url": "https://files.pythonhosted.org/packages/af/66/291c0689642bbd200b5b668b359971758037aa99f9aa12382713f61ad883/requestez-0.1.5.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-10-15 17:06:02",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "shashstormer",
    "github_project": "requestez",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [],
    "lcname": "requestez"
}
        
Elapsed time: 0.46291s