Skip to content

Commit

Permalink
apply stylized formatting, readme improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
ngschmidt committed Dec 26, 2021
1 parent edb4b55 commit fd6f859
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 6 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ cogitation_interface = Reliquary(args.f, input_user=api_user, input_pass=api_pas
cogitation_interface.namshub({{ }}, namshub_variables={{ }})
```

And then process data from there.
And then process data from there.
`namshub` currently exports text from the API, and may support a `dict` in the future.

## Notes

Expand Down
19 changes: 16 additions & 3 deletions restify/RuminatingCogitation.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,9 @@ class Reliquary:
cogitation_errors = {}

# We're pretty much picking up our configuration data
def __init__(self, input_settings, input_user=None, input_pass=None, input_endpoint=None):
def __init__(
self, input_settings, input_user=None, input_pass=None, input_endpoint=None
):

# Load Settings from JSON
try:
Expand Down Expand Up @@ -322,7 +324,13 @@ def do_api_pass(

# Executor of the API calls.
# Takes optional arguments (variables, payload) depending on which method is used
def namshub(self, namshub_string, namshub_variables=False, namshub_dryrun=False, namshub_payload=False):
def namshub(
self,
namshub_string,
namshub_variables=False,
namshub_dryrun=False,
namshub_payload=False,
):
# Sanitize the verb used to uppercase, fewer changes for mixup
namshub_verb = self.get_play_verb(namshub_string).lower().upper()
# URI is in JSON file
Expand Down Expand Up @@ -358,7 +366,12 @@ def namshub(self, namshub_string, namshub_variables=False, namshub_dryrun=False,
try:
namshub_payload = json.dumps(namshub_payload)
except Exception as e:
sys.exit("Error processing API payload as " + str(type(namshub_payload)) + " " + str(e))
sys.exit(
"Error processing API payload as "
+ str(type(namshub_payload))
+ " "
+ str(e)
)

# Now that the transforms, testing, pre-processing are done, let's send to an API!
if namshub_verb == "GET":
Expand Down
4 changes: 3 additions & 1 deletion restify/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,9 @@

# Set the interface - apply from variables
if api_endpoint and api_endpoint is str:
cogitation_interface = Reliquary(args.f, input_user=api_user, input_pass=api_pass, input_endpoint=api_endpoint)
cogitation_interface = Reliquary(
args.f, input_user=api_user, input_pass=api_pass, input_endpoint=api_endpoint
)
else:
cogitation_interface = Reliquary(args.f, input_user=api_user, input_pass=api_pass)

Expand Down
4 changes: 3 additions & 1 deletion restify/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,9 @@

# Set the interface - apply from variables
if api_endpoint and api_endpoint is str:
cogitation_interface = Reliquary(args.f, input_user=api_user, input_pass=api_pass, input_endpoint=api_endpoint)
cogitation_interface = Reliquary(
args.f, input_user=api_user, input_pass=api_pass, input_endpoint=api_endpoint
)
else:
cogitation_interface = Reliquary(args.f, input_user=api_user, input_pass=api_pass)

Expand Down

0 comments on commit fd6f859

Please sign in to comment.