Skip to content
Merged

Sdk #39

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
13 changes: 13 additions & 0 deletions memphis/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
# Copyright 2021-2022 The Memphis Authors
# Licensed under the Apache License, Version 2.0 (the “License”);
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at

# http://www.apache.org/licenses/LICENSE-2.0

# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an “AS IS” BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License

from memphis.memphis import Memphis
import memphis.retention_types
import memphis.storage_types
25 changes: 19 additions & 6 deletions memphis/http_request.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
# Copyright 2021-2022 The Memphis Authors
# Licensed under the Apache License, Version 2.0 (the “License”);
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at

# http://www.apache.org/licenses/LICENSE-2.0

# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an “AS IS” BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License

import requests
import json

Expand All @@ -13,13 +26,13 @@ def http_request(method, url, headers={}, body_params={}, query_params={}, file=
try:
typeOfMethod = {
"GET": requests.get(url, headers=headers, timeout=timeout,
data=json.dumps(body_params), params=json.dumps(query_params)),
"POST":requests.post(url, headers=headers, timeout=timeout,
data=json.dumps(body_params), params=json.dumps(query_params)),
data=json.dumps(body_params), params=json.dumps(query_params)),
"POST": requests.post(url, headers=headers, timeout=timeout,
data=json.dumps(body_params), params=json.dumps(query_params)),
'PUT': requests.put(url, headers=headers, timeout=timeout,
data=json.dumps(body_params), params=json.dumps(query_params)),
'DELETE':requests.delete(url, headers=headers, timeout=timeout,
data=json.dumps(body_params), params=json.dumps(query_params))
data=json.dumps(body_params), params=json.dumps(query_params)),
'DELETE': requests.delete(url, headers=headers, timeout=timeout,
data=json.dumps(body_params), params=json.dumps(query_params))
}
response = typeOfMethod.get(method)
if response.status_code != 200:
Expand Down
13 changes: 13 additions & 0 deletions memphis/memphis.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
# Copyright 2021-2022 The Memphis Authors
# Licensed under the Apache License, Version 2.0 (the “License”);
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at

# http://www.apache.org/licenses/LICENSE-2.0

# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an “AS IS” BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License

import socket
import json
import nats as broker
Expand Down
13 changes: 13 additions & 0 deletions memphis/retention_types.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
# Copyright 2021-2022 The Memphis Authors
# Licensed under the Apache License, Version 2.0 (the “License”);
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at

# http://www.apache.org/licenses/LICENSE-2.0

# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an “AS IS” BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License

MAX_MESSAGE_AGE_SECONDS = "message_age_sec"
MESSAGES = "messages"
BYTES = "bytes"
13 changes: 13 additions & 0 deletions memphis/storage_types.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,15 @@
# Copyright 2021-2022 The Memphis Authors
# Licensed under the Apache License, Version 2.0 (the “License”);
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at

# http://www.apache.org/licenses/LICENSE-2.0

# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an “AS IS” BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License

FILE = "file"
MEMORY = "memory"