Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
GÉANT Service Orchestrator
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
GÉANT Orchestration and Automation Team
GAP
GÉANT Service Orchestrator
Commits
dd28cfcb
Verified
Commit
dd28cfcb
authored
10 months ago
by
Karel van Klink
Browse files
Options
Downloads
Patches
Plain Diff
re-use TCP session in Kentik client
parent
2a4d4190
Branches
Branches containing commit
Tags
1.1.28
Tags containing commit
No related merge requests found
Pipeline
#88113
passed
10 months ago
Stage: tox
Stage: documentation
Stage: sonarqube
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
gso/services/kentik_client.py
+4
-3
4 additions, 3 deletions
gso/services/kentik_client.py
with
4 additions
and
3 deletions
gso/services/kentik_client.py
+
4
−
3
View file @
dd28cfcb
...
@@ -33,18 +33,19 @@ class KentikClient:
...
@@ -33,18 +33,19 @@ class KentikClient:
def
__init__
(
self
)
->
None
:
def
__init__
(
self
)
->
None
:
"""
Instantiate a new Kentik Client.
"""
"""
Instantiate a new Kentik Client.
"""
self
.
config
=
load_oss_params
().
KENTIK
self
.
config
=
load_oss_params
().
KENTIK
self
.
headers
=
{
self
.
session
=
requests
.
Session
()
self
.
session
.
headers
.
update
({
"
X-CH-Auth-Email
"
:
self
.
config
.
user_email
,
"
X-CH-Auth-Email
"
:
self
.
config
.
user_email
,
"
X-CH-Auth-API-Token
"
:
self
.
config
.
api_key
,
"
X-CH-Auth-API-Token
"
:
self
.
config
.
api_key
,
"
Content-Type
"
:
"
application/json
"
,
"
Content-Type
"
:
"
application/json
"
,
}
}
)
def
_send_request
(
def
_send_request
(
self
,
method
:
Literal
[
"
GET
"
,
"
POST
"
,
"
PUT
"
,
"
DELETE
"
],
endpoint
:
str
,
data
:
dict
[
str
,
Any
]
|
None
=
None
self
,
method
:
Literal
[
"
GET
"
,
"
POST
"
,
"
PUT
"
,
"
DELETE
"
],
endpoint
:
str
,
data
:
dict
[
str
,
Any
]
|
None
=
None
)
->
Response
:
)
->
Response
:
url
=
self
.
config
.
api_base
+
endpoint
url
=
self
.
config
.
api_base
+
endpoint
logger
.
debug
(
"
Kentik - Sending request
"
,
extra
=
{
"
method
"
:
method
,
"
endpoint
"
:
url
,
"
form_data
"
:
data
})
logger
.
debug
(
"
Kentik - Sending request
"
,
extra
=
{
"
method
"
:
method
,
"
endpoint
"
:
url
,
"
form_data
"
:
data
})
result
=
requests
.
request
(
method
,
url
,
json
=
data
,
headers
=
self
.
headers
)
result
=
self
.
session
.
request
(
method
,
url
,
json
=
data
)
logger
.
debug
(
"
Kentik - Received response
"
,
extra
=
result
.
__dict__
)
logger
.
debug
(
"
Kentik - Received response
"
,
extra
=
result
.
__dict__
)
return
result
return
result
...
...
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