Skip to content

Commit

Permalink
Merge pull request #216 from m4dm4rtig4n/0.8.10
Browse files Browse the repository at this point in the history
0.8.10
  • Loading branch information
m4dm4rtig4n authored Dec 12, 2022
2 parents 4cb4442 + 6f6f493 commit 5546986
Show file tree
Hide file tree
Showing 9 changed files with 168 additions and 128 deletions.
2 changes: 1 addition & 1 deletion app/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.8.8-release
0.8.10.beta1
238 changes: 119 additions & 119 deletions app/alembic/versions/0c07baa8d7b2_base.py

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion app/models/jobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def job_import_data(self, wait=True, target=None):
self.get_contract()
except Exception as e:
traceback.print_exc()
LOG.critical([f"Erreur lors de la récupération des informations du contract", e])
LOG.error([f"Erreur lors de la récupération des informations du contract", e])
try:
if target == "addresses" or target is None:
self.get_addresses()
Expand Down
5 changes: 4 additions & 1 deletion app/models/query_status.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import datetime
import json
import traceback

import __main__ as app

Expand Down Expand Up @@ -52,7 +53,7 @@ def status(self, usage_point_id):
app.LOG.log(f"{key}: {value}")
app.DB.usage_point_update(
usage_point_id,
consentement_expiration=datetime.datetime.strptime(status["consent_expiration_date"], "%Y-%m-%dT%H:%M:%S.%f"),
consentement_expiration=datetime.datetime.strptime(status["consent_expiration_date"], "%Y-%m-%dT%H:%M:%S"),
last_call=datetime.datetime.strptime(status["last_call"], "%Y-%m-%dT%H:%M:%S.%f"),
call_number=status["call_number"],
quota_limit=status["quota_limit"],
Expand All @@ -62,11 +63,13 @@ def status(self, usage_point_id):
)
return status
except LookupError:
traceback.print_exc()
return {
"error": True,
"description": "Erreur lors de la récupération du statut du compte."
}
else:
traceback.print_exc()
return {
"error": True,
"description": "Erreur lors de la récupération du statut du compte."
Expand Down
25 changes: 25 additions & 0 deletions app/models/rte.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
from rauth import OAuth2Service

class ExampleOAuth2Client:
def __init__(self, client_id, client_secret):
self.access_token = None

self.service = OAuth2Service(
name="foo",
client_id=client_id,
client_secret=client_secret,
access_token_url="http://api.example.com/oauth/access_token",
authorize_url="http://api.example.com/oauth/access_token",
base_url="http://api.example.com/",
)

self.get_access_token()

def get_access_token(self):
data = {'code': 'bar', # specific to my app
'grant_type': 'client_credentials', # generally required!
}

session = self.service.get_auth_session(data=data, decoder=json.loads)

self.access_token = session.access_token
3 changes: 2 additions & 1 deletion app/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ dependencies = [
"art",
"SQLAlchemy",
"alembic",
"waitress"
"waitress",
"rauth"
]

[project.optional-dependencies]
Expand Down
6 changes: 5 additions & 1 deletion app/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,12 @@ pytz-deprecation-shim==0.1.0.post0
# via tzlocal
pyyaml==6.0
# via myelectricaldata_import (pyproject.toml)
requests==2.28.1
rauth==0.7.3
# via myelectricaldata_import (pyproject.toml)
requests==2.28.1
# via
# myelectricaldata_import (pyproject.toml)
# rauth
rx==3.2.0
# via influxdb-client
six==1.16.0
Expand Down
2 changes: 1 addition & 1 deletion app/templates/js/gateway_status.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ if (document.URL.indexOf("/usage_point_id/") >= 0) {
"<td class='stat_key'>Statut de la passerelle</td><td class='stat_value'><img src='/static/img/" + gateway_state + "' style='width: 18px;'></td>" +
"</tr>" +
"<tr>" +
"<td class='stat_key'>Version</td><td class='stat_value' style='width: 100px'>" + version + "</td>" +
"<td class='stat_key'>Version</td><td class='stat_value' style='width: 150px'>" + version + "</td>" +
"</tr>" +
"<tr>" +
"<td class='" + information_class + "' colspan='2'>" + information + "</td>" +
Expand Down
13 changes: 10 additions & 3 deletions dependencies.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import __main__ as app
import os
import subprocess
import sys

from InquirerPy import inquirer, prompt
from InquirerPy.base import Choice
Expand Down Expand Up @@ -135,10 +136,16 @@ def create_release(prerelease=False):

if version not in tags:
prerelease = inquirer.confirm(
message="It's prerelease ? (deploy in sandbox)",
message="It's prerelease (beta version) ?",
).execute()
if prerelease:
version = f"{version}-dev"
beta_version = f"{version}-beta"
found_version = []
for vers in tags:
if vers.startswith(beta_version):
found_version.append(vers)
found_version.sort()
version = f"{beta_version}{len(found_version)+1}"
else:
version = f"{version}-release"

Expand Down Expand Up @@ -171,7 +178,7 @@ def create_release(prerelease=False):
app.LOG.log(" => Success")
app.LOG.title(f"Create release {version}")
prerelease_txt = ""
if version.endswith("-dev"):
if "-beta" in version:
prerelease_txt = "--prerelease"
os.system(f"gh release create -t {version} --generate-notes {prerelease_txt} {version}")
app.LOG.log(" => Success")
Expand Down

0 comments on commit 5546986

Please sign in to comment.