Skip to content

Commit

Permalink
Merge pull request #11 from cardoe/python3.13
Browse files Browse the repository at this point in the history
add Python 3.13+ support
  • Loading branch information
mnaser authored Oct 21, 2024
2 parents 0016357 + 730de17 commit 5bf12ad
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 17 deletions.
24 changes: 10 additions & 14 deletions keystoneauth_websso/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
# License for the specific language governing permissions and limitations
# under the License.

import cgi
import json
import os
import re
Expand All @@ -24,6 +23,7 @@
from datetime import datetime
from http.server import BaseHTTPRequestHandler, HTTPServer

import multipart
from keystoneauth1 import _utils as utils
from keystoneauth1.identity.v3 import federation

Expand Down Expand Up @@ -75,14 +75,13 @@ def do_POST(self):

if self.headers:

form = cgi.FieldStorage(
fp=self.rfile,
headers=self.headers,
environ={
"REQUEST_METHOD": "POST",
"CONTENT_TYPE": self.headers["Content-Type"],
},
)
environ = {
"REQUEST_METHOD": "POST",
"CONTENT_LENGTH": self.headers["Content-Length"],
"CONTENT_TYPE": self.headers["Content-Type"],
"wsgi.input": self.rfile,
}
forms, files = multipart.parse_form_data(environ)

self.send_response(200)
self.send_header("Content-type", "text/html")
Expand All @@ -95,11 +94,8 @@ def do_POST(self):
b"</body></html>"
)

for field in form.keys():
field_item = form[field]
if not field_item.filename:
# Regular Form Value
postvars[field] = form[field].value
for field, value in forms.items():
postvars[field] = value

self.server.token = postvars["token"]
else:
Expand Down
18 changes: 16 additions & 2 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,11 @@ classifiers = [
[tool.poetry.dependencies]
python = "^3.8"
keystoneauth1 = ">=5.0.0"
multipart = ">=1.0.0"

[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"

[tool.poetry.plugins."keystoneauth1.plugin"]
v3websso = "keystoneauth_websso.loading:OpenIDConnect"
v3websso = "keystoneauth_websso.loading:OpenIDConnect"

0 comments on commit 5bf12ad

Please sign in to comment.