Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

print response content #53

Closed
Closed
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
4 changes: 2 additions & 2 deletions pyscicat/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def __init__(
self._password is not None
), "SciCat login credentials (username, password) must be provided if token is not provided"
self._token = get_token(self._base_url, self._username, self._password)
self._headers["Authorization"] = "Bearer {}".format(self._token)
self._headers["Authorization"] = "Bearer {}".format(self._token)

def _send_to_scicat(self, cmd: str, endpoint: str, data: BaseModel = None):
"""sends a command to the SciCat API server using url and token, returns the response JSON
Expand All @@ -109,7 +109,7 @@ def _call_endpoint(
operation: str = "",
) -> Optional[dict]:
response = self._send_to_scicat(cmd=cmd, endpoint=endpoint, data=data)

print(response.content)
result = response.json() if len(response.content) > 0 else None
if not response.ok:
raise ScicatCommError(f"Error in operation {operation}: {result}")
Expand Down
10 changes: 9 additions & 1 deletion pyscicat/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ class Job(MongoQueryable):
jobResultObject: Optional[dict] = None # ibid.


class Instrument(MongoQueryable):
class InstrumentOrig(MongoQueryable):
"""
Instrument class, most of this is flexibly definable in customMetadata
"""
Expand All @@ -105,6 +105,14 @@ class Instrument(MongoQueryable):
name: str
customMetadata: Optional[dict] = None

class Instrument(MongoQueryable):
"""
Instrument class, most of this is flexibly definable in customMetadata
"""

uniqueName: Optional[str] = None
name: str
customMetadata: Optional[dict] = None

class Dataset(Ownable):
"""
Expand Down
Loading