Skip to content

Commit

Permalink
parking-free-slot-calculation: use odh-mobility-datacollector as clie…
Browse files Browse the repository at this point in the history
…nt id
  • Loading branch information
dulvui committed Dec 14, 2023
1 parent 330051a commit 429091d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/ci-parking-free-slot-calculation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ jobs:

# Program specific env variables
X_AUTHENTICATION_SERVER: https://auth.opendatahub.testingmachine.eu/auth/
X_CLIENT_SECRET: ${{ secrets.COMBINED_CLIENT_SECRET_TEST }}
X_CLIENT_SECRET: ${{ secrets.CLIENT_SECRET_TEST }}
X_CLIENT_ID: odh-mobility-datacollector
X_ODH_MOBILITY_API_NINJA: https://mobility.api.opendatahub.testingmachine.eu/v2
X_ODH_MOBILITY_API_WRITER: https://share.opendatahub.testingmachine.eu
X_PROVENANCE_LINEAGE: NOI
Expand Down Expand Up @@ -99,7 +100,8 @@ jobs:

# Program specific env variables
X_AUTHENTICATION_SERVER: https://auth.opendatahub.com/auth/
X_CLIENT_SECRET: ${{ secrets.COMBINED_CLIENT_SECRET_PROD }}
X_CLIENT_SECRET: ${{ secrets.CLIENT_SECRET_PROD }}
X_CLIENT_ID: odh-mobility-datacollector
X_ODH_MOBILITY_API_NINJA: https://mobility.api.opendatahub.com/v2
X_ODH_MOBILITY_API_WRITER: https://mobility.share.opendatahub.bz.it
X_PROVENANCE_LINEAGE: NOI
Expand Down
1 change: 1 addition & 0 deletions parking-free-slot-calculation/.env.example
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
AUTHENTICATION_SERVER=
CLIENT_SECRET=
CLIENT_ID=
ODH_MOBILITY_API_NINJA=
ODH_MOBILITY_API_WRITER=
PROVENANCE_LINEAGE=NOI
Expand Down
5 changes: 2 additions & 3 deletions parking-free-slot-calculation/src/odh_pusher.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
# Configure client
keycloak_openid = KeycloakOpenID(
server_url= os.getenv("AUTHENTICATION_SERVER"),
client_id="odh-a22-dataprocessor",
client_id=os.getenv("CLIENT_ID"),
realm_name="noi",
client_secret_key=os.getenv("CLIENT_SECRET"),
verify=True
Expand All @@ -32,10 +32,9 @@ def createDataMap(self,station,dataType,dataPoints):

def sendData(self,stationType, dataMap):
token = keycloak_openid.token("", "","client_credentials")
r = requests.post(os.getenv("ODH_MOBILITY_API_WRITER")+"/json/pushRecords/"+stationType, json=dataMap, headers={"Authorization" : "Bearer " + token['access_token']})
r = requests.post(os.getenv("ODH_MOBILITY_API_WRITER")+"/json/pushRecords/"+stationType, json=dataMap, headers={"Content-Type": "application/json","Authorization" : f"Bearer " + token['access_token']})
if (r.status_code != 201):
print("Status code not 201 but " + str(r.status_code))
print(r.text)

def upsertProvenance(self):
collector = os.getenv("PROVENANCE_NAME")
Expand Down

0 comments on commit 429091d

Please sign in to comment.