Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Redner Odoo Module
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Package Registry
Operate
Terraform modules
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
XCG
Odoo modules
Redner Odoo Module
Commits
990cc4ecf4bd
Commit
990cc4ecf4bd
authored
3 years ago
by
Houzefa Abbasbhay
Browse files
Options
Downloads
Patches
Plain Diff
Configurable timeout, default is 20 seconds
parent
834be989e557
No related branches found
No related tags found
1 merge request
!12
Topic/11.0/zouzou
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
NEWS.rst
+5
-0
5 additions, 0 deletions
NEWS.rst
README.rst
+2
-0
2 additions, 0 deletions
README.rst
__manifest__.py
+1
-1
1 addition, 1 deletion
__manifest__.py
models/redner.py
+12
-6
12 additions, 6 deletions
models/redner.py
models/redner_template.py
+1
-0
1 addition, 0 deletions
models/redner_template.py
with
21 additions
and
7 deletions
NEWS.rst
+
5
−
0
View file @
990cc4ec
...
@@ -2,6 +2,11 @@
...
@@ -2,6 +2,11 @@
NEWS
NEWS
====
====
11.0.2.5.0
==========
* Configurable timeout for redner calls, default is 20 seconds.
11.0.2.4.1
11.0.2.4.1
==========
==========
...
...
This diff is collapsed.
Click to expand it.
README.rst
+
2
−
0
View file @
990cc4ec
...
@@ -18,4 +18,5 @@
...
@@ -18,4 +18,5 @@
redner.server_url = http://dockerhost:7000
redner.server_url = http://dockerhost:7000
redner.api_key = <your API key here>
redner.api_key = <your API key here>
redner.account = <your account name>
redner.account = <your account name>
redner.timeout = 20
...
@@ -21,4 +22,5 @@
...
@@ -21,4 +22,5 @@
``redner.timeout`` is in seconds; defaults to 20 seconds per redner call.
**Pro tip**: You can use mjml-app_ to prototype your email templates.
**Pro tip**: You can use mjml-app_ to prototype your email templates.
...
...
This diff is collapsed.
Click to expand it.
__manifest__.py
+
1
−
1
View file @
990cc4ec
...
@@ -21,7 +21,7 @@
...
@@ -21,7 +21,7 @@
"
name
"
:
"
Redner
"
,
"
name
"
:
"
Redner
"
,
"
summary
"
:
"""
"
summary
"
:
"""
Allows to generate transactional emails and documents in PDF or HTML format
"""
,
Allows to generate transactional emails and documents in PDF or HTML format
"""
,
"
version
"
:
"
11.0.2.
4.1
"
,
"
version
"
:
"
11.0.2.
5.0
"
,
"
author
"
:
"
XCG Consulting
"
,
"
author
"
:
"
XCG Consulting
"
,
"
category
"
:
"
Technical
"
,
"
category
"
:
"
Technical
"
,
"
depends
"
:
[
"
base
"
,
"
mail
"
,
"
converter
"
],
"
depends
"
:
[
"
base
"
,
"
mail
"
,
"
converter
"
],
...
...
This diff is collapsed.
Click to expand it.
models/redner.py
+
12
−
6
View file @
990cc4ec
...
@@ -15,9 +15,9 @@
...
@@ -15,9 +15,9 @@
class
Redner
(
object
):
class
Redner
(
object
):
def
__init__
(
self
,
api_key
,
server_url
,
account
):
def
__init__
(
self
,
api_key
,
server_url
,
account
,
timeout
):
"""
Initialize the API client
"""
Initialize the API client
Args:
Args:
api_key(str): provide your Redner API key.
api_key(str): provide your Redner API key.
server_url(str): Redner server URL.
server_url(str): Redner server URL.
...
@@ -19,7 +19,8 @@
...
@@ -19,7 +19,8 @@
"""
Initialize the API client
"""
Initialize the API client
Args:
Args:
api_key(str): provide your Redner API key.
api_key(str): provide your Redner API key.
server_url(str): Redner server URL.
server_url(str): Redner server URL.
timeout(float): Timeout per Redner call, in seconds.
"""
"""
...
@@ -24,4 +25,5 @@
...
@@ -24,4 +25,5 @@
"""
"""
self
.
session
=
requests
.
session
()
self
.
api_key
=
api_key
self
.
server_url
=
server_url
self
.
account
=
account
self
.
account
=
account
...
@@ -27,6 +29,7 @@
...
@@ -27,6 +29,7 @@
self
.
account
=
account
self
.
account
=
account
self
.
server_url
=
server_url
self
.
timeout
=
timeout
self
.
api_key
=
api_key
self
.
session
=
requests
.
sessions
.
Session
()
self
.
templates
=
Templates
(
self
)
self
.
templates
=
Templates
(
self
)
def
call
(
self
,
path
,
http_verb
=
"
post
"
,
**
params
):
def
call
(
self
,
path
,
http_verb
=
"
post
"
,
**
params
):
...
@@ -70,7 +73,10 @@
...
@@ -70,7 +73,10 @@
start
=
time
.
time
()
start
=
time
.
time
()
r
=
getattr
(
self
.
session
,
http_verb
,
"
post
"
)(
r
=
getattr
(
self
.
session
,
http_verb
,
"
post
"
)(
url
,
json
=
params
,
headers
=
{
"
Rednerd-API-Key
"
:
self
.
api_key
}
url
,
json
=
params
,
headers
=
{
"
Rednerd-API-Key
"
:
self
.
api_key
},
timeout
=
self
.
timeout
,
)
)
complete_time
=
time
.
time
()
-
start
complete_time
=
time
.
time
()
-
start
...
@@ -96,7 +102,7 @@
...
@@ -96,7 +102,7 @@
def
ping
(
self
):
def
ping
(
self
):
"""
Try to establish a connection to server
"""
"""
Try to establish a connection to server
"""
conn
=
self
.
session
.
get
(
self
.
server_url
)
conn
=
self
.
session
.
get
(
self
.
server_url
,
timeout
=
self
.
timeout
)
if
conn
.
status_code
!=
requests
.
codes
.
ok
:
if
conn
.
status_code
!=
requests
.
codes
.
ok
:
raise
ValidationError
(
"
Cannot Establish a connection to server
"
)
raise
ValidationError
(
"
Cannot Establish a connection to server
"
)
return
conn
return
conn
...
...
This diff is collapsed.
Click to expand it.
models/redner_template.py
+
1
−
0
View file @
990cc4ec
...
@@ -86,6 +86,7 @@
...
@@ -86,6 +86,7 @@
config_model
.
get_param
(
"
redner.api_key
"
),
config_model
.
get_param
(
"
redner.api_key
"
),
config_model
.
get_param
(
"
redner.server_url
"
),
config_model
.
get_param
(
"
redner.server_url
"
),
config_model
.
get_param
(
"
redner.account
"
),
config_model
.
get_param
(
"
redner.account
"
),
int
(
config_model
.
get_param
(
"
redner.timeout
"
,
default
=
"
20
"
)),
)
)
return
self
.
_redner
return
self
.
_redner
...
...
This diff is collapsed.
Click to expand it.
Houzefa Abbasbhay
@houzefa.abba
mentioned in commit
a8874c6c9a77
·
3 years ago
mentioned in commit
a8874c6c9a77
mentioned in commit a8874c6c9a77af2c382d68a26423fac9cd34acd7
Toggle commit list
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment