alertlogic / alertlogic-sdk-python Goto Github PK
View Code? Open in Web Editor NEWAlert Logic Software Development Kit for Python
License: MIT License
Alert Logic Software Development Kit for Python
License: MIT License
Updating the url based on customer residency does not work for test use cases. For example,
$ cat ~/.alertlogic/config
[aetuner_int]
access_key_id=skip
secret_key=skip
global_endpoint=localhost3001
$ cat api/aetuner.v1.yaml
...
servers:
- url: 'https://aetuner.mdr.global.alertlogic.com'
x-alertlogic-global-endpoint: production
description: production
- url: 'https://aetuner.mdr.product.dev.alertlogic.com'
x-alertlogic-global-endpoint: integration
description: integration
- url: 'http://localhost:3000'
x-alertlogic-global-endpoint: localhost3000
description: localhost on port 3000
...
$ _venv/bin/alcli --profile aetuner_int aetuner get_analytic --account_id $account_id --path ngx/SuspConfCng/AwsPacu --enable_new=1
Traceback (most recent call last):
File "/Users/rkarol-admin/github/alertlogic/aetuner/_venv/lib/python3.7/site-packages/alcli/alertlogic_cli.py", line 116, in main
return services[parsed_args.service](remaining, parsed_args)
File "/Users/rkarol-admin/github/alertlogic/aetuner/_venv/lib/python3.7/site-packages/alcli/alertlogic_cli.py", line 199, in __call__
res = operation(**op_args)
File "/Users/rkarol-admin/github/alertlogic/aetuner/_venv/lib/python3.7/site-packages/almdrlib/client.py", line 619, in __call__
return self._call(*args, **kwargs)
File "/Users/rkarol-admin/github/alertlogic/aetuner/_venv/lib/python3.7/site-packages/almdrlib/client.py", line 586, in f
self._server.update_url(account_id)
File "/Users/rkarol-admin/github/alertlogic/aetuner/_venv/lib/python3.7/site-packages/almdrlib/client.py", line 52, in update_url
self._url = self._session.get_url(self._service_name, account_id)
File "/Users/rkarol-admin/github/alertlogic/aetuner/_venv/lib/python3.7/site-packages/almdrlib/session.py", line 260, in get_url
self.residency),
File "/Users/rkarol-admin/github/alertlogic/aetuner/_venv/lib/python3.7/site-packages/almdrlib/session.py", line 304, in request
**kwargs)
File "/Users/rkarol-admin/github/alertlogic/aetuner/_venv/lib/python3.7/site-packages/requests/sessions.py", line 528, in request
prep = self.prepare_request(req)
File "/Users/rkarol-admin/github/alertlogic/aetuner/_venv/lib/python3.7/site-packages/requests/sessions.py", line 466, in prepare_request
hooks=merge_hooks(request.hooks, self.hooks),
File "/Users/rkarol-admin/github/alertlogic/aetuner/_venv/lib/python3.7/site-packages/requests/models.py", line 316, in prepare
self.prepare_url(url, params)
File "/Users/rkarol-admin/github/alertlogic/aetuner/_venv/lib/python3.7/site-packages/requests/models.py", line 390, in prepare_url
raise MissingSchema(error)
requests.exceptions.MissingSchema: Invalid URL 'localhost3001/endpoints/v1/134255110/residency/default/services/aetuner/endpoint': No schema supplied. Perhaps you meant http://localhost3001/endpoints/v1/134255110/residency/default/services/aetuner/endpoint?
In these cases update_url
here should not update the URL based on the customer
residency.
alertlogic-sdk-python/almdrlib/client.py
Line 585 in a8a08ed
When looking up an endpoint for a service call, this needs to happen based on the account ID in the request.
account_id
in the parameters for a service call: use this ID for looking up the endpoint for the requestaccount_id
in the parameters, but account_id
required by the API: account_id
inherited from the logged in user, and used in endpoint lookupNot sure what the behavior should be for services that don't have an account ID in the API definition (there are just a few of these)
Note: a single service client may make requests to many different account IDs over the course of its lifetime.
session.py does not specify a timeout parameter on calls to requests.session.request()
. As a result, the well-documented default of the requests module is to apply no timeout. There is no way to override this behavior in almdrlib
.
Partial stack trace from a typical case where a request times out (here, because my machine went to sleep while a script was running)
File "/Users/msayler/Projects/cli/alertlogic-sdk-python/almdrlib/client.py", line 709, in __call__
return self._call(*args, **kwargs)
File "/Users/msayler/Projects/cli/alertlogic-sdk-python/almdrlib/client.py", line 699, in f
return self._session.request(
File "/Users/msayler/Projects/cli/alertlogic-sdk-python/almdrlib/session.py", line 306, in request
response = self._session.request(
File "/opt/homebrew/lib/python3.10/site-packages/requests/sessions.py", line 587, in request
resp = self.send(prep, **send_kwargs)
File "/opt/homebrew/lib/python3.10/site-packages/requests/sessions.py", line 701, in send
r = adapter.send(request, **kwargs)
File "/opt/homebrew/lib/python3.10/site-packages/requests/adapters.py", line 489, in send
resp = conn.urlopen(
File "/opt/homebrew/lib/python3.10/site-packages/urllib3/connectionpool.py", line 703, in urlopen
httplib_response = self._make_request(
File "/opt/homebrew/lib/python3.10/site-packages/urllib3/connectionpool.py", line 449, in _make_request
six.raise_from(e, None)
File "<string>", line 3, in raise_from
File "/opt/homebrew/lib/python3.10/site-packages/urllib3/connectionpool.py", line 444, in _make_request
httplib_response = conn.getresponse()
File "/opt/homebrew/Cellar/[email protected]/3.10.9/Frameworks/Python.framework/Versions/3.10/lib/python3.10/http/client.py", line 1374, in getresponse
response.begin()
File "/opt/homebrew/Cellar/[email protected]/3.10.9/Frameworks/Python.framework/Versions/3.10/lib/python3.10/http/client.py", line 318, in begin
version, status, reason = self._read_status()
File "/opt/homebrew/Cellar/[email protected]/3.10.9/Frameworks/Python.framework/Versions/3.10/lib/python3.10/http/client.py", line 279, in _read_status
line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
File "/opt/homebrew/Cellar/[email protected]/3.10.9/Frameworks/Python.framework/Versions/3.10/lib/python3.10/socket.py", line 705, in readinto
return self._sock.recv_into(b)
File "/opt/homebrew/Cellar/[email protected]/3.10.9/Frameworks/Python.framework/Versions/3.10/lib/python3.10/ssl.py", line 1274, in recv_into
return self.read(nbytes, buffer)
File "/opt/homebrew/Cellar/[email protected]/3.10.9/Frameworks/Python.framework/Versions/3.10/lib/python3.10/ssl.py", line 1130, in read
return self._sslobj.read(len, buffer)
KeyboardInterrupt
(Removed because I didn't realize there was an alcli repo)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.