ansys / pyhps

A Python client for Ansys HPC Platform Services (HPS)
https://hps.docs.pyansys.com/
MIT License
0 stars 0 forks source link

Session calls replacing default Python request headers #418

Closed brocksmith-onscale closed 1 month ago

brocksmith-onscale commented 2 months ago

🔍 Before submitting the issue

🐞 Description of the bug

In a few spots the sesssion.headers is set where is should be session.headers.update to preserve the default headers that the Python requests library includes.

Examples: https://github.com/ansys/pyhps/blob/main/src/ansys/hps/client/authenticate.py#L97 https://github.com/ansys/pyhps/blob/main/src/ansys/hps/client/connection.py#L67

This will be blocked by basic WAF security rules for missing required headers like the 'User-Agent' header

📝 Steps to reproduce

Create a Client object trying to connect to the HPS services deployed in the OnScale environment. The WAF rules will block you because you don't have a 'User-Agent' header

💻 Which operating system are you using?

Windows

📀 Which ANSYS version are you using?

No response

🐍 Which Python version are you using?

3.11

📦 Installed packages

aiofiles==23.2.1
annotated-types==0.7.0
ansys-dcs-monitor-source @ git+https://github.com/ansys-internal/dcs-monitor-source-py.git@3aeb843f794523f71e7c6a5d247d9c0db9ca0f36
ansys-hps-client @ file:///pyhps
ansys-rep-common @ file:///rep-common-py
ansys-rep-evaluator @ file:///rep-evaluator/rep_evaluator
ansys-rep-evaluator-plugins @ file:///rep-evaluator/rep_evaluator_plugins
ansys-rep-file-tool @ git+https://github.com/ansys-internal/rep-job-management.git@48debe8903e705b04f4e46026de8595e4f43e766#subdirectory=rep_file_tool
ansys-rep-fitness @ git+https://github.com/ansys-internal/rep-job-management.git@48debe8903e705b04f4e46026de8595e4f43e766#subdirectory=rep_fitness
ansys-rep-orchestration-interfaces @ git+https://github.com/ansys-internal/rep-orchestration-interfaces.git@7d110733ce860aa954fe0238f637fa2dcb013137
ansys-rep-schemas @ git+https://github.com/ansys-internal/rep-schemas.git@88086ef12581b203010dff7f66e44c09428cf29b
anyio==4.4.0
arrow==1.3.0
asgiref==3.8.1
attrs==23.2.0
Authlib==1.3.0
backoff==2.2.1
bcrypt==4.1.3
beautifulsoup4==4.12.3
boto3==1.16.52
botocore==1.19.63
bytecode==0.15.1
cachetools==5.3.3
cattrs==23.2.3
certifi==2024.6.2
cffi==1.16.0
chardet==3.0.4
charset-normalizer==3.3.2
click==8.1.7
colorama==0.4.6
cryptography==42.0.7
datadog==0.46.0
ddsketch==3.0.1
ddtrace==2.8.3
deepdiff==7.0.1
deepmerge==1.1.1
Deprecated==1.2.14
dnspython==2.6.1
envier==0.5.1
environs==11.0.0
expiringdict==1.2.2
falcon==3.1.3
falcon-auth2==0.1.0
filelock==3.14.0
flatten-dict==0.4.2
googleapis-common-protos==1.63.1
greenlet==3.0.3
grpcio==1.63.0
grpcio-tools==1.63.0
h11==0.14.0
httpcore==1.0.5
httptools==0.6.1
httpx==0.27.0
humanfriendly==10.0
idna==2.10
importlib-metadata==7.0.0
jaraco.functools==4.0.1
Jinja2==3.1.4
jmespath==0.10.0
loguru==0.7.2
markdownify==0.12.1
MarkupSafe==2.1.5
marshmallow==3.21.2
marshmallow-enum==1.5.1
marshmallow-oneofschema==3.1.1
more-itertools==10.3.0
natsort==8.4.0
netifaces==0.11.0
onscale-pcl==0.15.0
onscale-sidecar @ file:///OnScale_Sidecar/python_client
opentelemetry-api==1.24.0
opentelemetry-exporter-otlp-proto-common==1.24.0
opentelemetry-exporter-otlp-proto-grpc==1.24.0
opentelemetry-instrumentation==0.45b0
opentelemetry-instrumentation-asgi==0.45b0
opentelemetry-instrumentation-fastapi==0.45b0
opentelemetry-instrumentation-logging==0.45b0
opentelemetry-instrumentation-requests==0.45b0
opentelemetry-instrumentation-system-metrics==0.45b0
opentelemetry-proto==1.24.0
opentelemetry-sdk==1.24.0
opentelemetry-sdk-extension-aws==2.0.1
opentelemetry-semantic-conventions==0.45b0
opentelemetry-util-http==0.45b0
ordered-set==4.1.0
packaging==24.1
paramiko==2.7.2
pathtools==0.1.2
pika==1.2.0
pluggy==1.5.0
portend==3.2.0
protobuf==4.25.3
psutil==5.9.8
pycparser==2.22
pycryptodome==3.9.7
pycurl==7.45.2
pydantic==2.7.1
pydantic-settings==2.2.1
pydantic_core==2.18.2
PyJWT==2.8.0
pymongo==3.12.1
PyNaCl==1.5.0
python-dateutil==2.9.0.post0
python-dotenv==1.0.1
python-rapidjson==1.17
PyYAML==6.0.1
requests==2.32.2
requests-file==1.2
requests-futures==1.0.1
requests-toolbelt==0.9.1
s3transfer==0.3.7
six==1.16.0
sniffio==1.3.1
soupsieve==2.5
sqlparse==0.5.0
tempora==5.6.0
timeflake==0.4.3
types-python-dateutil==2.9.0.20240316
typing_extensions==4.11.0
urllib3==1.25.11
uvicorn==0.29.0
uvloop==0.19.0
watchdog==4.0.1
watchfiles==0.22.0
websocket-client==0.57.0
websockets==12.0
wrapt==1.16.0
xmltodict==0.13.0
yappi==1.6.0
zipp==3.18.1