Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
api_connector
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Le Filament
Odoo APIs
api_connector
Merge requests
!2
[ADD] add headers from response in return
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
[ADD] add headers from response in return
14.0-get-headers-from-request
into
14.0
Overview
0
Commits
1
Changes
2
Merged
Julien - Le Filament
requested to merge
14.0-get-headers-from-request
into
14.0
4 months ago
Overview
0
Commits
1
Changes
2
Expand
Merge request reports
Compare
14.0
14.0 (base)
and
latest version
latest version
79a4cdf4
1 commit,
4 months ago
2 files
+
13
−
10
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
2
Search (e.g. *.vue) (Ctrl+P)
models/api_connector.py
+
12
−
9
Options
@@ -40,7 +40,7 @@ class ApiConnector(models.AbstractModel):
# ------------------------------------------------------
# API functions
# ------------------------------------------------------
def
call_api
(
self
,
url
,
call_type
,
**
kwargs
):
def
call_api
(
self
,
url
,
call_type
,
with_headers
=
False
,
**
kwargs
):
"""
:param url: action API Alfresco
:param call_type: post/get/put/delete
@@ -66,16 +66,19 @@ class ApiConnector(models.AbstractModel):
except
Exception
as
e
:
raise
e
if
with_headers
:
return
response
.
json
(),
response
.
headers
return
response
.
json
()
def
api_get
(
self
,
url
,
**
kwargs
):
return
self
.
call_api
(
url
,
"
get
"
,
**
kwargs
)
def
api_get
(
self
,
url
,
with_headers
=
False
,
**
kwargs
):
return
self
.
call_api
(
url
,
"
get
"
,
with_headers
=
with_headers
,
**
kwargs
)
def
api_post
(
self
,
url
,
**
kwargs
):
return
self
.
call_api
(
url
,
"
post
"
,
**
kwargs
)
def
api_post
(
self
,
url
,
with_headers
=
False
,
**
kwargs
):
return
self
.
call_api
(
url
,
"
post
"
,
with_headers
=
with_headers
,
**
kwargs
)
def
api_put
(
self
,
url
,
**
kwargs
):
return
self
.
call_api
(
url
,
"
put
"
,
**
kwargs
)
def
api_put
(
self
,
url
,
with_headers
=
False
,
**
kwargs
):
return
self
.
call_api
(
url
,
"
put
"
,
with_headers
=
with_headers
,
**
kwargs
)
def
api_delete
(
self
,
url
,
**
kwargs
):
return
self
.
call_api
(
url
,
"
delete
"
,
**
kwargs
)
def
api_delete
(
self
,
url
,
with_headers
=
False
,
**
kwargs
):
return
self
.
call_api
(
url
,
"
delete
"
,
with_headers
=
with_headers
,
**
kwargs
)
Loading