Skip to content

Add HTTPProtocol #22

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ jobs:
run: |
pip install --upgrade build twine
for file in $(find -not -path "./.*" -not -path "./docs*" \( -name "*.py" -o -name "*.toml" \) ); do
sed -i -e "s/0.0.0-auto.0/1.2.3/" $file;
sed -i -e "s/0.0.0+auto.0/1.2.3/" $file;
done;
python -m build
twine check dist/*
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ jobs:
TWINE_PASSWORD: ${{ secrets.pypi_password }}
run: |
for file in $(find -not -path "./.*" -not -path "./docs*" \( -name "*.py" -o -name "*.toml" \) ); do
sed -i -e "s/0.0.0-auto.0/${{github.event.release.tag_name}}/" $file;
sed -i -e "s/0.0.0+auto.0/${{github.event.release.tag_name}}/" $file;
done;
python -m build
twine upload dist/*
2 changes: 1 addition & 1 deletion circuitpython_typing/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
* Author(s): Alec Delaney, Dan Halbert, Randy Hudson
"""

__version__ = "0.0.0-auto.0"
__version__ = "0.0.0+auto.0"
__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_Typing.git"

import array
Expand Down
40 changes: 40 additions & 0 deletions circuitpython_typing/http.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# SPDX-FileCopyrightText: Copyright (c) 2022 Alec Delaney
#
# SPDX-License-Identifier: MIT

"""
`circuitpython_typing.http`
===========================
Type annotation definitions for HTTP and related objects
* Author(s): Alec Delaney
"""

# Protocol was introduced in Python 3.8.
from typing_extensions import Protocol
from adafruit_requests import Response


class HTTPProtocol(Protocol):
"""Protocol for HTTP request managers, like typical wifi managers"""

def get(self, url: str, **kw) -> Response:
"""Send HTTP GET request"""
...

def put(self, url: str, **kw) -> Response:
"""Send HTTP PUT request"""
...

def post(self, url: str, **kw) -> Response:
"""Send HTTP POST request"""
...

def patch(self, url: str, **kw) -> Response:
"""Send HTTP PATCH request"""
...

def delete(self, url: str, **kw) -> Response:
"""Send HTTP DELETE request"""
...
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ requires = [
[project]
name = "adafruit-circuitpython-typing"
description = "Types needed for type annotation that are not in `typing`"
version = "0.0.0-auto.0"
version = "0.0.0+auto.0"
readme = "README.rst"
authors = [
{name = "Adafruit Industries", email = "[email protected]"}
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@

typing_extensions~=4.0
adafruit-circuitpython-busdevice
adafruit-circuitpython-requests