Skip to content

Commit 0240919

Browse files
author
Viktors Patmalnieks
committed
repackaged
0 parents  commit 0240919

27 files changed

+1002
-0
lines changed

.gitignore

+162
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,162 @@
1+
.vscode/
2+
3+
# Byte-compiled / optimized / DLL files
4+
__pycache__/
5+
*.py[cod]
6+
*$py.class
7+
8+
# C extensions
9+
*.so
10+
11+
# Distribution / packaging
12+
.Python
13+
build/
14+
develop-eggs/
15+
dist/
16+
downloads/
17+
eggs/
18+
.eggs/
19+
lib/
20+
lib64/
21+
parts/
22+
sdist/
23+
var/
24+
wheels/
25+
share/python-wheels/
26+
*.egg-info/
27+
.installed.cfg
28+
*.egg
29+
MANIFEST
30+
31+
# PyInstaller
32+
# Usually these files are written by a python script from a template
33+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
34+
*.manifest
35+
*.spec
36+
37+
# Installer logs
38+
pip-log.txt
39+
pip-delete-this-directory.txt
40+
41+
# Unit test / coverage reports
42+
htmlcov/
43+
.tox/
44+
.nox/
45+
.coverage
46+
.coverage.*
47+
.cache
48+
nosetests.xml
49+
coverage.xml
50+
*.cover
51+
*.py,cover
52+
.hypothesis/
53+
.pytest_cache/
54+
cover/
55+
56+
# Translations
57+
*.mo
58+
*.pot
59+
60+
# Django stuff:
61+
*.log
62+
local_settings.py
63+
db.sqlite3
64+
db.sqlite3-journal
65+
66+
# Flask stuff:
67+
instance/
68+
.webassets-cache
69+
70+
# Scrapy stuff:
71+
.scrapy
72+
73+
# Sphinx documentation
74+
docs/_build/
75+
76+
# PyBuilder
77+
.pybuilder/
78+
target/
79+
80+
# Jupyter Notebook
81+
.ipynb_checkpoints
82+
83+
# IPython
84+
profile_default/
85+
ipython_config.py
86+
87+
# pyenv
88+
# For a library or package, you might want to ignore these files since the code is
89+
# intended to run in multiple environments; otherwise, check them in:
90+
# .python-version
91+
92+
# pipenv
93+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
94+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
95+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
96+
# install all needed dependencies.
97+
#Pipfile.lock
98+
99+
# poetry
100+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
101+
# This is especially recommended for binary packages to ensure reproducibility, and is more
102+
# commonly ignored for libraries.
103+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
104+
#poetry.lock
105+
106+
# pdm
107+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
108+
#pdm.lock
109+
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
110+
# in version control.
111+
# https://pdm.fming.dev/#use-with-ide
112+
.pdm.toml
113+
114+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
115+
__pypackages__/
116+
117+
# Celery stuff
118+
celerybeat-schedule
119+
celerybeat.pid
120+
121+
# SageMath parsed files
122+
*.sage.py
123+
124+
# Environments
125+
.env
126+
.venv
127+
env/
128+
venv/
129+
ENV/
130+
env.bak/
131+
venv.bak/
132+
133+
# Spyder project settings
134+
.spyderproject
135+
.spyproject
136+
137+
# Rope project settings
138+
.ropeproject
139+
140+
# mkdocs documentation
141+
/site
142+
143+
# mypy
144+
.mypy_cache/
145+
.dmypy.json
146+
dmypy.json
147+
148+
# Pyre type checker
149+
.pyre/
150+
151+
# pytype static type analyzer
152+
.pytype/
153+
154+
# Cython debug symbols
155+
cython_debug/
156+
157+
# PyCharm
158+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
159+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
160+
# and can be added to the global gitignore or merged into this file. For a more nuclear
161+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
162+
#.idea/

LICENSE

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
2+
Version 2, December 2004
3+
4+
Copyright (C) 2004 Sam Hocevar <[email protected]>
5+
6+
Everyone is permitted to copy and distribute verbatim or modified
7+
copies of this license document, and changing it is allowed as long
8+
as the name is changed.
9+
10+
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
11+
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
12+
13+
0. You just DO WHAT THE FUCK YOU WANT TO.

Makefile

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
2+
build:
3+
@echo Generating Distribution Packages
4+
@python -m build
5+
6+
test-publish:
7+
@python -m twine upload --repository testpypi dist/*
8+
9+
10+
publish-pypi:
11+
@python -m twine upload dist/*
12+

README.md

+63
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# HTTP Code Lookup
2+
Allows you to very quickly view and search [Wikipedia's HTTP Codes](https://en.wikipedia.org/wiki/List_of_HTTP_status_codes) page.
3+
4+
## What the hell is this?
5+
Look up specific codes
6+
7+
![code lookup](https://i.ibb.co/vBWgJS1/image.png)
8+
9+
Filter using wildcards
10+
11+
![wildcard lookup](https://i.ibb.co/CWZ3ZW1/image.png)
12+
13+
Don't know the status code?
14+
15+
![text lookup](https://i.ibb.co/9TQgxtw/image.png)
16+
17+
18+
## How to run
19+
Install `requirements.txt` using `pip install -r requirements.txt`. Although not required, setting up a [`virtualenv`](https://www.freecodecamp.org/news/how-to-setup-virtual-environments-in-python/) is advised.
20+
21+
### Using Python
22+
```bash
23+
python main.py <search_term>
24+
```
25+
26+
### Using alias/DOSKEY
27+
Setting up an alias for the script will allow you to use a custom, short "name" for any action.
28+
29+
For Unix systems place the following into `.bashrc` or `.zshrc`
30+
```bash
31+
alias http-code="path/to/python /path/to/main.py $@"
32+
```
33+
34+
For Windows place the following into your bat file that runs on terminal startup. If you do not know how to set this up, look into [this answer on Stack Overflow](https://superuser.com/questions/1749663/add-launch-commands-to-command-prompt-in-windows-terminal)
35+
```bat
36+
DOSKEY http-code="path/to/python /path/to/main.py" $*
37+
```
38+
39+
40+
### Arguments
41+
The usage for the tool is as follows:
42+
```bash
43+
python main.py <search_term> --output-as-json --no-pretty --indent-size --no-colour
44+
```
45+
* `<search_term>`
46+
* **Mandatory**: Can be either a 3 digit code (use x to replace unknowns, eg: 2xx for all codes starting with 2) or a text search.
47+
* `--output-as-json`
48+
* _Optional_: Output as JSON, by default will pretty-print JSON... use `--no-pretty` to disable
49+
* `--no-pretty`
50+
* _Optional_: Disable pretty printing of JSON, does nothing without `--output-as-json` flag set
51+
* `--indent-size`
52+
* _Optional_: Change the default (2) indent size
53+
* `--no-colour`
54+
* _Optional_: Disable colour for non-JSON output
55+
56+
57+
## How to test
58+
```bash
59+
python tests/test.py
60+
```
61+
62+
## Known Issues
63+
* Tests don't run on Windows systems :|

pyproject.toml

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
[project]
2+
name = "httpcode"
3+
version = "1.0.0"
4+
authors = [{ name = "hamolicious", email = "[email protected]" }]
5+
description = "Quickly look up HTTP codes in the terminal"
6+
readme = "README.md"
7+
requires-python = ">=3.12"
8+
dependencies = [
9+
"colorama==0.4.6",
10+
"fire==0.5.0",
11+
"six==1.16.0",
12+
"termcolor==2.4.0",
13+
]
14+
classifiers = [
15+
"Programming Language :: Python :: 3",
16+
"License :: OSI Approved :: MIT License",
17+
"Operating System :: OS Independent",
18+
]
19+
20+
[project.urls]
21+
Homepage = "https://github.com/pypa/sampleproject"
22+
Issues = "https://github.com/pypa/sampleproject/issues"
23+
24+
[build-system]
25+
requires = ["hatchling"]
26+
build-backend = "hatchling.build"
27+
28+
[tool.hatch.build.targets.wheel]
29+
packages = ["src/httpcode/__main__.py", "src/httpcode/codes.json"]

requirements.txt

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
colorama==0.4.6
2+
fire==0.5.0
3+
six==1.16.0
4+
termcolor==2.4.0

0 commit comments

Comments
 (0)