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
3f6dafff95f0
Commit
3f6dafff95f0
authored
3 years ago
by
Houzefa Abbasbhay
Browse files
Options
Downloads
Patches
Plain Diff
Configurable timeout, default is 20 seconds
parent
938b441e8c28
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!19
forward port of 11.0 features
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
NEWS.rst
+7
-0
7 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_template.py
+1
-0
1 addition, 0 deletions
models/redner_template.py
redner.py
+12
-6
12 additions, 6 deletions
redner.py
with
23 additions
and
7 deletions
NEWS.rst
+
7
−
0
View file @
3f6dafff
...
...
@@ -2,6 +2,13 @@
NEWS
====
13.0.3.1.0
==========
(forward port of 11.0.2.5.0)
* Configurable timeout for redner calls, default is 20 seconds.
13.0.3.0.2
==========
...
...
This diff is collapsed.
Click to expand it.
README.rst
+
2
−
0
View file @
3f6dafff
...
...
@@ -19,4 +19,5 @@
redner.server_url = http://dockerhost:7000
redner.api_key = <your API key here>
redner.account = <your account name>
redner.timeout = 20
...
...
@@ -22,4 +23,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.
...
...
This diff is collapsed.
Click to expand it.
__manifest__.py
+
1
−
1
View file @
3f6dafff
...
...
@@ -21,7 +21,7 @@
"
name
"
:
"
Redner
"
,
"
summary
"
:
"""
Allows to generate transactional emails and documents in PDF or HTML format
"""
,
"
version
"
:
"
13.0.3.
0.2
"
,
"
version
"
:
"
13.0.3.
1.0
"
,
"
category
"
:
"
Technical
"
,
"
author
"
:
"
XCG Consulting
"
,
"
website
"
:
"
http://odoo.consulting/
"
,
...
...
This diff is collapsed.
Click to expand it.
models/redner_template.py
+
1
−
0
View file @
3f6dafff
...
...
@@ -89,6 +89,7 @@
config_model
.
get_param
(
"
redner.api_key
"
),
config_model
.
get_param
(
"
redner.server_url
"
),
config_model
.
get_param
(
"
redner.account
"
),
int
(
config_model
.
get_param
(
"
redner.timeout
"
,
default
=
"
20
"
)),
)
return
self
.
_redner
...
...
This diff is collapsed.
Click to expand it.
redner.py
+
12
−
6
View file @
3f6dafff
...
...
@@ -15,9 +15,9 @@
class
Redner
(
object
):
def
__init__
(
self
,
api_key
,
server_url
,
account
):
def
__init__
(
self
,
api_key
,
server_url
,
account
,
timeout
):
"""
Initialize the API client
Args:
api_key(str): provide your Redner API key.
server_url(str): Redner server URL.
...
...
@@ -19,7 +19,8 @@
"""
Initialize the API client
Args:
api_key(str): provide your Redner API key.
server_url(str): Redner server URL.
timeout(float): Timeout per Redner call, in seconds.
"""
...
...
@@ -24,4 +25,5 @@
"""
self
.
session
=
requests
.
session
()
self
.
api_key
=
api_key
self
.
server_url
=
server_url
self
.
account
=
account
...
...
@@ -27,6 +29,7 @@
self
.
account
=
account
self
.
server_url
=
server_url
self
.
api_key
=
api_key
self
.
timeout
=
timeout
self
.
session
=
requests
.
sessions
.
Session
()
self
.
templates
=
Templates
(
self
)
def
call
(
self
,
path
,
http_verb
=
"
post
"
,
**
params
):
...
...
@@ -70,7 +73,10 @@
start
=
time
.
time
()
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
...
...
@@ -96,7 +102,7 @@
def
ping
(
self
):
"""
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
:
raise
ValidationError
(
"
Cannot Establish a connection to server
"
)
return
conn
...
...
This diff is collapsed.
Click to expand it.
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