From d9ce9fb9a5568b00f244bd710e38ae8bcb26c61b Mon Sep 17 00:00:00 2001 From: Dietrich Date: Sat, 23 Apr 2022 19:17:31 +0200 Subject: [PATCH] Initial commit --- Dockerfile | 6 ++++++ LICENSE.txt | 22 ++++++++++++++++++++++ README.md | 2 ++ pyproject.toml | 13 +++++++++++++ pyprotest/__main__.py | 5 +++++ pyprotest/request.py | 4 ++++ tests/__init__.py | 0 tests/test_request.py | 9 +++++++++ 8 files changed, 61 insertions(+) create mode 100644 Dockerfile create mode 100644 LICENSE.txt create mode 100644 README.md create mode 100644 pyproject.toml create mode 100644 pyprotest/__main__.py create mode 100644 pyprotest/request.py create mode 100644 tests/__init__.py create mode 100644 tests/test_request.py diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..d8b59f9 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,6 @@ +FROM docker.io/python:3.10-alpine + +COPY . src +RUN cd src && pip install --no-cache-dir . + +CMD ["python", "-m", "myproj"] diff --git a/LICENSE.txt b/LICENSE.txt new file mode 100644 index 0000000..2422cdd --- /dev/null +++ b/LICENSE.txt @@ -0,0 +1,22 @@ +The MIT License (MIT) + +Copyright © 2022 + + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the “Software”), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..533749b --- /dev/null +++ b/README.md @@ -0,0 +1,2 @@ +# Python Project +This is a test package. diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..bfd1a16 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,13 @@ +[project] +name = "pyprotest" +version = "0.0.1" +description = "My pyproject test" +readme = "README.md" +license = { file = "LICENSE.txt" } +authors = [ + { name = "Dietrich Rink" } +] + +dependencies = [ + "requests ~= 2.27.1" +] diff --git a/pyprotest/__main__.py b/pyprotest/__main__.py new file mode 100644 index 0000000..a613672 --- /dev/null +++ b/pyprotest/__main__.py @@ -0,0 +1,5 @@ +from .request import make_request + +resp = make_request() +print(resp.status_code) +print(resp.text) diff --git a/pyprotest/request.py b/pyprotest/request.py new file mode 100644 index 0000000..44b4dc6 --- /dev/null +++ b/pyprotest/request.py @@ -0,0 +1,4 @@ +import requests + +def make_request(): + return requests.get('https://wtfismyip.com/text') diff --git a/tests/__init__.py b/tests/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/test_request.py b/tests/test_request.py new file mode 100644 index 0000000..5433abc --- /dev/null +++ b/tests/test_request.py @@ -0,0 +1,9 @@ +from unittest import TestCase + +from pyprotest import request + +class TestRequest(TestCase): + def test_request(self): + resp = request.make_request() + self.assertEqual(resp.status_code, 200) +