Skip to content

Commit

Permalink
[PYPI-RELEASE] release v0.6.0
Browse files Browse the repository at this point in the history
  • Loading branch information
djs0109 authored Nov 27, 2024
2 parents 6cc3a75 + ac48754 commit f4be3e6
Show file tree
Hide file tree
Showing 32 changed files with 4,782 additions and 79 deletions.
1 change: 1 addition & 0 deletions .env.filip.EXAMPLE
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# local file `.env.filip` in the root folder, i.e., ".../FiLiP/.env.filip"
# Do not add the created `.env.filip` to the git
CB_URL="http://localhost:1026"
LD_CB_URL="http://localhost:1027"
IOTA_URL="http://localhost:4041/"
QL_URL="http://localhost:8668"
MQTT_BROKER_URL="mqtt://localhost:1883"
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ requirements.txt
.idea
.cache
venv

.venv
# Unittest #
#####################
.pytest_cache
Expand Down
20 changes: 17 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,21 @@
### v0.6.X
### v0.6.0
- add: Tutorial for connecting with secured endpoints ([#319](https://github.com/RWTH-EBC/FiLiP/pull/319))
- add: tests for clear functions ([#318](https://github.com/RWTH-EBC/FiLiP/pull/336))
- fix: clear functions for context broker ([#318](https://github.com/RWTH-EBC/FiLiP/pull/336))
- add: Example for notification based command ([#332](https://github.com/RWTH-EBC/FiLiP/pull/332))
- add: tests for clear functions ([#336](https://github.com/RWTH-EBC/FiLiP/pull/336))
- 🚀 **add: API client for NGSI-LD context broker** ([#338](https://github.com/RWTH-EBC/FiLiP/pull/338)
,[#356](https://github.com/RWTH-EBC/FiLiP/pull/356)
,[#327](https://github.com/RWTH-EBC/FiLiP/pull/327)
,[#300](https://github.com/RWTH-EBC/FiLiP/pull/300)
,[#301](https://github.com/RWTH-EBC/FiLiP/pull/301)
,[#212](https://github.com/RWTH-EBC/FiLiP/pull/212)
,[#222](https://github.com/RWTH-EBC/FiLiP/pull/222)
,[#221](https://github.com/RWTH-EBC/FiLiP/pull/221)
)
- fix: clear functions for context broker ([#336](https://github.com/RWTH-EBC/FiLiP/pull/336))
- fix: validation error of ``ngsipayloadattr`` when the attribute substitution is used([#351](https://github.com/RWTH-EBC/FiLiP/pull/351))
- update: integrate the key-values endpoints with normalized endpoints ([#318](https://github.com/RWTH-EBC/FiLiP/pull/318))
- remove: ``update_entity_attributes_key_values`` and ``update_entity_key_values`` are removed ([#318](https://github.com/RWTH-EBC/FiLiP/pull/318))


### v0.5.0
- update: allow duplicated name in device, check uniqueness of object_id ([#279](https://github.com/RWTH-EBC/FiLiP/pull/279))
Expand Down
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,11 @@ Therefore, FiLiP currently only covers the APIs of the following GEs:
- [github](https://github.com/telefonicaid/fiware-orion)
- [swagger](https://swagger.lab.fiware.org/)
- [NGSI v2 specifications](https://github.com/FIWARE/specifications/tree/master/OpenAPI/ngsiv2)
- NGSI-LD Context Broker for managing context data with Linked Data concept. The functionalities that FiLiP supports are closely aligned with the specification **_NGSI-LD V1.3.1_**, which is according to the FIWARE [catalogue](https://github.com/FIWARE/catalogue#core-context-broker-components) the latest spec version that has been implemented by all three brokers (Orion-LD, Scorpio, and Stellio). We currently use Orion-LD for testing.
- [github](https://github.com/FIWARE/context.Orion-LD)
- [swagger](https://swagger.lab.fiware.org/?url=https://raw.githubusercontent.com/FIWARE/specifications/master/OpenAPI/ngsi-ld/full_api.json#/)
> **Note**: `-experimental` flag need to be set for Orion-LD Context Broker to enable the full functionality. Check this [issue](https://github.com/FIWARE/context.Orion-LD/issues/1648) for more information
- IoT-Agents for managing IoT Devices. IoT agents are implemented using
the FIWARE IoT Agent Node Lib as a common framework.
Expand Down
2 changes: 1 addition & 1 deletion filip/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
from filip.config import settings
from filip.clients.ngsi_v2 import HttpClient

__version__ = '0.5.0'
__version__ = '0.6.0'
20 changes: 17 additions & 3 deletions filip/clients/base_http_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,17 @@
from pydantic import AnyHttpUrl
from typing import Dict, ByteString, List, IO, Tuple, Union
import requests

from filip.models.base import FiwareHeader
from filip.models.base import FiwareHeader, FiwareLDHeader
from filip.utils import validate_http_url
from enum import Enum


class NgsiURLVersion(str, Enum):
"""
URL part that defines the NGSI version for the API.
"""
v2_url = "/v2"
ld_url = "/ngsi-ld/v1"


class BaseHttpClient:
Expand All @@ -26,7 +34,7 @@ def __init__(self,
url: Union[AnyHttpUrl, str] = None,
*,
session: requests.Session = None,
fiware_header: Union[Dict, FiwareHeader] = None,
fiware_header: Union[Dict, FiwareHeader, FiwareLDHeader] = None,
**kwargs):

self.logger = logging.getLogger(
Expand Down Expand Up @@ -92,10 +100,16 @@ def fiware_headers(self, headers: Union[Dict, FiwareHeader]) -> None:
"""
if isinstance(headers, FiwareHeader):
self._fiware_headers = headers
elif isinstance(headers, FiwareLDHeader):
self._fiware_headers = headers
elif isinstance(headers, dict):
self._fiware_headers = FiwareHeader.model_validate(headers)
elif isinstance(headers, str):
self._fiware_headers = FiwareHeader.model_validate_json(headers)
elif isinstance(headers, dict):
self._fiware_headers = FiwareLDHeader.parse_obj(headers)
elif isinstance(headers, str):
self._fiware_headers = FiwareLDHeader.parse_raw(headers)
else:
raise TypeError(f'Invalid headers! {type(headers)}')
self.headers.update(self.fiware_headers.model_dump(by_alias=True))
Expand Down
Loading

0 comments on commit f4be3e6

Please sign in to comment.