Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions nomad/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
from typing import Optional, Union

import requests
from urllib.parse import quote
from requests_unixsocket import Session

from nomad import api

Expand Down Expand Up @@ -67,6 +69,8 @@ def __init__( # pylint: disable=too-many-arguments
self.secure = secure
self.port = port
self.address = address or os.getenv("NOMAD_ADDR", None)
if self.address and self.address.startswith("unix://"):
self.address = "http+unix://" + quote(self.address[7:], safe = "")
self.user_agent = user_agent
self.region = region or os.getenv("NOMAD_REGION", None)
self.timeout = timeout
Expand All @@ -75,6 +79,8 @@ def __init__( # pylint: disable=too-many-arguments
self.verify = verify
self.cert = cert if all(cert) else ()
self.session = session
if not self.session and self.address and self.address.startswith("http+unix://"):
self.session = Session()
self.__namespace = namespace or os.getenv("NOMAD_NAMESPACE", None)

self.requester_settings = {
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
requests==2.32.2
requests-unixsocket==0.4.1
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
setuptools.setup(
name='python-nomad',
version='2.1.0',
install_requires=['requests'],
install_requires=['requests', 'requests-unixsocket'],
packages=['nomad', 'nomad.api'],
url='http://github.com/jrxfive/python-nomad',
license='MIT',
Expand Down