Skip to content

Commit

Permalink
Merge pull request #46 from PrediktorAS/jn/changeToUseAnyURL
Browse files Browse the repository at this point in the history
Change HttpUrl to allow for calling rest url's where we dont have TLD
  • Loading branch information
jNormaster authored Sep 22, 2023
2 parents 00f1dbe + fd7d6e3 commit 7bae0d5
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/pyprediktormapclient/auth_client.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from pydantic import BaseModel, HttpUrl, validate_call, AwareDatetime, field_validator
from pydantic import BaseModel, AnyUrl, validate_call, AwareDatetime, field_validator
from pyprediktormapclient.shared import request_from_api
import datetime
import json
Expand Down Expand Up @@ -35,7 +35,7 @@ class AUTH_CLIENT:
"""
@validate_call
def __init__(self, rest_url: HttpUrl, username: str, password: str):
def __init__(self, rest_url: AnyUrl, username: str, password: str):
"""Class initializer
Args:
Expand Down
4 changes: 2 additions & 2 deletions src/pyprediktormapclient/model_index.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import json
import logging
from typing import List
from pydantic import HttpUrl, validate_call
from pydantic import AnyUrl, validate_call
from pyprediktormapclient.shared import request_from_api

logger = logging.getLogger(__name__)
Expand All @@ -19,7 +19,7 @@ class ModelIndex:
"""

@validate_call
def __init__(self, url: HttpUrl):
def __init__(self, url: AnyUrl):
self.url = url
self.object_types = self.get_object_types()

Expand Down
4 changes: 2 additions & 2 deletions src/pyprediktormapclient/opc_ua.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import pandas as pd
from datetime import date, datetime, timedelta
from typing import Dict, List, Union, Optional
from pydantic import BaseModel, HttpUrl, AnyUrl, validate_call
from pydantic import BaseModel, AnyUrl, validate_call
from pydantic_core import Url
from pyprediktormapclient.shared import request_from_api
from requests import HTTPError
Expand Down Expand Up @@ -152,7 +152,7 @@ class Config:


@validate_call
def __init__(self, rest_url: HttpUrl, opcua_url: AnyUrl, namespaces: List = None, auth_client: object = None):
def __init__(self, rest_url: AnyUrl, opcua_url: AnyUrl, namespaces: List = None, auth_client: object = None):
"""Class initializer
Args:
Expand Down
4 changes: 2 additions & 2 deletions src/pyprediktormapclient/shared.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import requests
from pydantic import HttpUrl, validate_call
from pydantic import AnyUrl, validate_call
from typing import Literal


@validate_call
def request_from_api(
rest_url: HttpUrl,
rest_url: AnyUrl,
method: Literal["GET", "POST"],
endpoint: str,
data: str = None,
Expand Down

0 comments on commit 7bae0d5

Please sign in to comment.