-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
383 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
name: Unittests | ||
|
||
on: | ||
push: | ||
branches: [ "main" ] | ||
pull_request: | ||
branches: [ "main" ] | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up Python 3.12 | ||
uses: actions/setup-python@v3 | ||
with: | ||
python-version: "3.10" | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
curl -sSL https://install.python-poetry.org | python - | ||
echo "$HOME/.local/bin" >> $GITHUB_PATH | ||
- name: Tests | ||
run: | | ||
poetry run python -m unittest discover -s tests | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
name: Publish Release | ||
|
||
on: | ||
release: | ||
types: [ created ] | ||
|
||
jobs: | ||
publish: | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
python-version: [ 3.9 ] | ||
poetry-version: [ 1.6.1 ] | ||
os: [ ubuntu-latest ] | ||
runs-on: ${{ matrix.os }} | ||
permissions: | ||
contents: read | ||
id-token: write | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-python@v2 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- name: Build Poetry image | ||
uses: abatilo/actions-poetry@v2 | ||
with: | ||
poetry-version: ${{ matrix.poetry-version }} | ||
- name: Run Poetry image | ||
uses: abatilo/actions-poetry@v2 | ||
with: | ||
poetry-version: ${{ matrix.poetry-version }} | ||
- name: Set release version | ||
id: set_version | ||
run: | | ||
echo "RELEASE_VERSION=$(poetry version -s)" >> $GITHUB_ENV | ||
- name: Show release version | ||
run: echo "Release version is ${{ env.RELEASE_VERSION }}" | ||
- name: Build PuePy | ||
run: | | ||
poetry build | ||
- name: Publish package distributions to PyPI | ||
uses: pypa/gh-action-pypi-publish@release/v1 |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# WsgiGo | ||
|
||
## What is it? | ||
|
||
WSGI go is a very simple WSGI router with no requirements. It is written for Python 3, though it could be | ||
easily backported. | ||
|
||
## Installation | ||
|
||
``` | ||
pip install wsgigo | ||
``` | ||
|
||
## Usage | ||
|
||
You can use it to route WSGI requests to specific apps based on hostname, URL fragment, or (through extending the | ||
Route class) other criteria. For example, suppose you have three wsgi apps which you want to serve as one:: | ||
|
||
```python | ||
from wsgigo import AppRouter | ||
|
||
app = AppRouter(default_app=main_website) | ||
app.add_startswith(docs_app, '/docs/') | ||
app.add_hostname(api_app, 'api.local') | ||
app.add_regexp(animal_app, '/(?:monkey|ape)/') | ||
``` | ||
|
||
You can also make your own router class, to route apps how you need them to be routed:: | ||
|
||
```python | ||
class InternetExplorerRouter(Route): | ||
def claim(self, environ): | ||
user_agent = environ['HTTP_USER_AGENT'] | ||
if 'Trident/7.0' in user_agent or 'MSIE' in user_agent: | ||
return True | ||
|
||
internet_explorer_app = TestWsgiApp("<b>really simple webpage</b>") | ||
real_app = TestWsgiApp("<b>really ADVANCED webpage</b>") | ||
|
||
router = AppRouter(default_app=real_app) | ||
router.add_route(InternetExplorerRouter(internet_explorer_app)) | ||
``` |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.