Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
production
building-knowledge-centre
building-dao
Commits
2bc923c9
Commit
2bc923c9
authored
Oct 03, 2019
by
Marc-Andre Santune
Browse files
set timeout
parent
1b648ab6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
1 deletion
+4
-1
building_dao/building_generic.py
building_dao/building_generic.py
+4
-1
No files found.
building_dao/building_generic.py
View file @
2bc923c9
...
@@ -222,6 +222,7 @@ class BuildingGeneric:
...
@@ -222,6 +222,7 @@ class BuildingGeneric:
url
:
str
,
url
:
str
,
json
:
Optional
[
dict
]
=
None
,
json
:
Optional
[
dict
]
=
None
,
headers
:
Optional
[
dict
]
=
None
,
headers
:
Optional
[
dict
]
=
None
,
**
kwargs
):
):
"""Request method. Retry if it failed"""
"""Request method. Retry if it failed"""
res
=
self
.
_req
(
method
=
method
,
url
=
url
,
json
=
json
,
headers
=
headers
)
res
=
self
.
_req
(
method
=
method
,
url
=
url
,
json
=
json
,
headers
=
headers
)
...
@@ -233,13 +234,15 @@ class BuildingGeneric:
...
@@ -233,13 +234,15 @@ class BuildingGeneric:
url
:
str
,
url
:
str
,
json
:
Optional
[
dict
]
=
None
,
json
:
Optional
[
dict
]
=
None
,
headers
:
Optional
[
dict
]
=
None
,
headers
:
Optional
[
dict
]
=
None
,
timeout
=
5
,
**
kwargs
):
):
"""Request method"""
"""Request method"""
if
headers
is
None
:
if
headers
is
None
:
headers
=
{}
headers
=
{}
headers
=
{
**
headers
,
"Api-Key"
:
self
.
settings
.
api_key
}
headers
=
{
**
headers
,
"Api-Key"
:
self
.
settings
.
api_key
}
res
=
requests
.
request
(
method
,
url
,
json
=
json
,
headers
=
headers
)
res
=
requests
.
request
(
method
,
url
,
json
=
json
,
headers
=
headers
,
timeout
=
timeout
,
**
kwargs
)
res
.
raise_for_status
()
res
.
raise_for_status
()
try
:
try
:
return
res
.
json
()
return
res
.
json
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment