commit a31a172557fd932a761f2efa9178d676b728034c Author: Hazel Date: Wed Jun 11 08:57:22 2025 +0000 Initial commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..5d381cc --- /dev/null +++ b/.gitignore @@ -0,0 +1,162 @@ +# ---> Python +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + +# C extensions +*.so + +# Distribution / packaging +.Python +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +wheels/ +share/python-wheels/ +*.egg-info/ +.installed.cfg +*.egg +MANIFEST + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.nox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*.cover +*.py,cover +.hypothesis/ +.pytest_cache/ +cover/ + +# Translations +*.mo +*.pot + +# Django stuff: +*.log +local_settings.py +db.sqlite3 +db.sqlite3-journal + +# Flask stuff: +instance/ +.webassets-cache + +# Scrapy stuff: +.scrapy + +# Sphinx documentation +docs/_build/ + +# PyBuilder +.pybuilder/ +target/ + +# Jupyter Notebook +.ipynb_checkpoints + +# IPython +profile_default/ +ipython_config.py + +# pyenv +# For a library or package, you might want to ignore these files since the code is +# intended to run in multiple environments; otherwise, check them in: +# .python-version + +# pipenv +# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. +# However, in case of collaboration, if having platform-specific dependencies or dependencies +# having no cross-platform support, pipenv may install dependencies that don't work, or not +# install all needed dependencies. +#Pipfile.lock + +# poetry +# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control. +# This is especially recommended for binary packages to ensure reproducibility, and is more +# commonly ignored for libraries. +# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control +#poetry.lock + +# pdm +# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control. +#pdm.lock +# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it +# in version control. +# https://pdm.fming.dev/#use-with-ide +.pdm.toml + +# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm +__pypackages__/ + +# Celery stuff +celerybeat-schedule +celerybeat.pid + +# SageMath parsed files +*.sage.py + +# Environments +.env +.venv +env/ +venv/ +ENV/ +env.bak/ +venv.bak/ + +# Spyder project settings +.spyderproject +.spyproject + +# Rope project settings +.ropeproject + +# mkdocs documentation +/site + +# mypy +.mypy_cache/ +.dmypy.json +dmypy.json + +# Pyre type checker +.pyre/ + +# pytype static type analyzer +.pytype/ + +# Cython debug symbols +cython_debug/ + +# PyCharm +# JetBrains specific template is maintained in a separate JetBrains.gitignore that can +# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore +# and can be added to the global gitignore or merged into this file. For a more nuclear +# option (not recommended) you can uncomment the following to ignore the entire idea folder. +#.idea/ + diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..8505055 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,21 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "name": "Python Debugger: Current File", + "type": "debugpy", + "request": "launch", + "program": "${file}", + "console": "integratedTerminal" + }, + { + "name": "Python Debugger: Python-Requests", + "type": "debugpy", + "request": "launch", // run the module + "program": "${workspaceFolder}/.vscode/run_script.py", + } + ] +} \ No newline at end of file diff --git a/.vscode/run_script.py b/.vscode/run_script.py new file mode 100644 index 0000000..4d3be15 --- /dev/null +++ b/.vscode/run_script.py @@ -0,0 +1,3 @@ +from python_requests.__main__ import cli + +cli() diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..d19b170 --- /dev/null +++ b/LICENSE @@ -0,0 +1,57 @@ +# 🏳️‍🌈 Opinionated Queer License v1.2 + +© Copyright {Licensor} + +## Permissions + +The creators of this Work (“The Licensor”) grant permission +to any person, group or legal entity that doesn't violate the prohibitions below (“The User”), +to do everything with this Work that would otherwise infringe their copyright or any patent claims, +subject to the following conditions: + +## Obligations + +The User must give appropriate credit to the Licensor, +provide a copy of this license or a (clickable, if the medium allows) link to +[oql.avris.it/license/v1.2](https://oql.avris.it/license/v1.2), +and indicate whether and what kind of changes were made. +The User may do so in any reasonable manner, +but not in any way that suggests the Licensor endorses the User or their use. + +## Prohibitions + +No one may use this Work for prejudiced or bigoted purposes, including but not limited to: +racism, xenophobia, queerphobia, queer exclusionism, homophobia, transphobia, enbyphobia, misogyny. + +No one may use this Work to inflict or facilitate violence or abuse of human rights, +as defined in either of the following documents: +[Universal Declaration of Human Rights](https://www.un.org/en/about-us/universal-declaration-of-human-rights), +[European Convention on Human Rights](https://prd-echr.coe.int/web/echr/european-convention-on-human-rights) +along with the rulings of the [European Court of Human Rights](https://www.echr.coe.int/). + +No law enforcement, carceral institutions, immigration enforcement entities, military entities or military contractors +may use the Work for any reason. This also applies to any individuals employed by those entities. + +No business entity where the ratio of pay (salaried, freelance, stocks, or other benefits) +between the highest and lowest individual in the entity is greater than 50 : 1 +may use the Work for any reason. + +No private business run for profit with more than a thousand employees +may use the Work for any reason. + +Unless the User has made substantial changes to the Work, +or uses it only as a part of a new work (eg. as a library, as a part of an anthology, etc.), +they are prohibited from selling the Work. +That prohibition includes processing the Work with machine learning models. + +## Sanctions + +If the Licensor notifies the User that they have not complied with the rules of the license, +they can keep their license by complying within 30 days after the notice. +If they do not do so, their license ends immediately. + +## Warranty + +This Work is provided “as is”, without warranty of any kind, express or implied. +The Licensor will not be liable to anyone for any damages related to the Work or this license, +under any kind of legal claim as far as the law allows. diff --git a/README.md b/README.md new file mode 100644 index 0000000..687d3cd --- /dev/null +++ b/README.md @@ -0,0 +1,7 @@ +# Python-Requests + +A Python library for simplified HTTP requests, featuring rate limiting, browser-like headers, and automatic retries. Built on the official `requests` library for reliability. + +## License + +This project is licensed under the [**🏳️‍🌈 Opinionated Queer License v1.2**](https://oql.avris.it/license). So use is strictly prohibited for cops, military and everyone who actively works against human rights. diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..e5a3af4 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,38 @@ +[project] +name = "python-requests" +dependencies = [] +dynamic = [] +authors = [] +description = "A Python library for simplified HTTP requests, featuring rate limiting, browser-like headers, and automatic retries. Built on the official `requests` library for reliability." +readme = "README.md" +requires-python = ">=3.10" +classifiers = [ + "Programming Language :: Python :: 3", + "Operating System :: OS Independent", +] +license-files = [ + "LICENSE" +] + +[project.scripts] +python-requests = "python_requests.__main__:cli" + +[project.urls] +Homepage = "/Hazel/python-requests" +Issues = "REPO_LINKissues" + +[build-system] +requires = ["hatchling"] +build-backend = "hatchling.build" + +[tool.hatch.build] +directory = "dist" + +[tool.hatch.build.targets.sdist] +include = ["python_requests/*.py"] + +[tool.hatch.build.targets.wheel] +packages = ["python_requests"] + +[tool.hatch.version] +path = "python_requests/__about__.py" diff --git a/python_requests/__init__.py b/python_requests/__init__.py new file mode 100644 index 0000000..3f8252a --- /dev/null +++ b/python_requests/__init__.py @@ -0,0 +1,6 @@ +import pathlib + + +__name__ = "python_requests" +__folder__ = str(pathlib.Path(__file__).parent) + diff --git a/python_requests/__main__.py b/python_requests/__main__.py new file mode 100644 index 0000000..e0ad0bc --- /dev/null +++ b/python_requests/__main__.py @@ -0,0 +1,34 @@ +import argparse +import logging + + +def cli(): + parser = argparse.ArgumentParser( + description="A Python library for simplified HTTP requests, featuring rate limiting, browser-like headers, and automatic retries. Built on the official `requests` library for reliability.", + formatter_class=argparse.RawTextHelpFormatter + ) + + parser.add_argument( + "--debug", + action="store_true", + help="Sets the logging level to debug." + ) + + args = parser.parse_args() + + # Configure logging based on the debug flag + if args.debug: + logging.basicConfig( + level=logging.DEBUG, + format='%(asctime)s - %(levelname)s - %(message)s' + ) + logging.debug("Debug logging enabled") + else: + logging.basicConfig( + level=logging.INFO, + format='%(asctime)s - %(levelname)s - %(message)s' + ) + + +if __name__ == "__main__": + cli()