Created
April 11, 2020 16:15
-
-
Save mcohen01/d4084ec4239783d7388e70aa32c566c8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
import requests as r | |
import pprint | |
import sys | |
class Command: | |
def __init__(self) -> None: | |
self.headers = { | |
"Authorization": "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJlYjhiODkyZC00YzhjLTRmMmItYTNhNi0xODY3NWY3M2VmODMiLCJwYXRpZW50X2lkIjoiIiwicG9saWN5X2lkIjoiIiwicGF5ZXJfaWQiOiIiLCJwZXJtaXNzaW9ucyI6WyJhZGQtYWRkcmVzc2VzIiwiYWRkLWNsZWFyaW5naG91c2UiLCJhZGQtc2Z0cC1pbmZvLXNldHRpbmdzIiwiY3JlYXRlLXBhdGllbnQtc3RhdGVtZW50cyIsImNyZWF0ZS1wYXllZS1wYXltZW50LWNvbmZpZ3VyYXRpb24iLCJjcmVhdGUtcGF5ZWVzIiwiY3JlYXRlLXBheWVlcy1wYXllcnMtYWN0aXZhdGlvbiIsImNyZWF0ZS11c2VycyIsImVkaXQtYWNjb3VudHMtcmVjZWl2YWJsZSIsImVkaXQtYW55LXBhdGllbnQtcHJvZmlsZSIsImVkaXQtY2xlYXJpbmdob3VzZSIsImVkaXQtZHJhZnQtZXJhcyIsImVkaXQtZ2xvYmFsLXNldHRpbmdzIiwiZWRpdC1wYXllZS1wYXltZW50LWNvbmZpZ3VyYXRpb24iLCJlZGl0LXBheWVlcyIsImVkaXQtcGF5ZWVzLXBheWVycy1hY3RpdmF0aW9uIiwiZWRpdC1wYXllciIsImVkaXQtc2Z0cC1pbmZvLXNldHRpbmdzIiwiZWRpdC11c2VycyIsImZsYWctbWV0cmljcyIsImlzc3VlLWRyYWZ0LWVyYXMiLCJpc3N1ZS1wYXRpZW50LXJlZnVuZHMiLCJtYWtlLXBhdGllbnQtZmluYW5jaWFsLWFkanVzdG1lbnRzIiwibWFrZS1wYXRpZW50LXBheW1lbnRzIiwibWFuYWdlLWFueS1wYXltZW50LW1ldGhvZHMiLCJ2aWV3LWFjY291bnRzLXJlY2VpdmFibGUiLCJ2aWV3LWFja25vd2xlZGdlbWVudHMiLCJ2aWV3LWFueS1jbGFpbS1wYXltZW50Iiwidmlldy1hbnktcGF0aWVudC1maW5hbmNpYWxzIiwidmlldy1hbnktcGF0aWVudC1wcm9maWxlIiwidmlldy1hbnktcGF0aWVudC1zdGF0ZW1lbnRzIiwidmlldy1hbnktcGF5ZWUtcGF5bWVudC1jb25maWd1cmF0aW9ucyIsInZpZXctYW55LXBheWVyIiwidmlldy1hbnktcG9saWN5Iiwidmlldy1iYWxhbmNlLXVwZGF0ZXMiLCJ2aWV3LWNsZWFyaW5naG91c2UiLCJ2aWV3LWVyYXMiLCJ2aWV3LWdsb2JhbC1zZXR0aW5ncyIsInZpZXctbG9ja2JveC1maWxlcyIsInZpZXctbWV0cmljcyIsInZpZXctb3Blbi1iYWxhbmNlcyIsInZpZXctcGF5ZWVzIiwidmlldy1wYXllZXMtcGF5ZXJzLWFjdGl2YXRpb24iLCJ2aWV3LXBheWVlcy1wYXltZW50cyIsInZpZXctcmVmdW5kLXdvcmtsaXN0Iiwidmlldy1yZXZlcnNhbHMiLCJ2aWV3LXNmdHAtaW5mby1zZXR0aW5ncyJdfQ.EqfqEXkPXaGsSHtoA4DEdImrGWID9LWKYRTSaVaNIwk", | |
"Content-Type": "application/json" | |
} | |
def _print(self, resp): | |
pp = pprint.PrettyPrinter(indent=4, width=200) | |
pp.pprint(resp.json()) | |
def receive_837(self, uri): | |
resp = r.post('http://localhost:5000/api/receive-837', | |
headers=self.headers, json={ | |
"uri": uri, | |
"unescaped": 1, | |
"noSugar": 0, | |
"isInstitutional": '837i' in uri | |
} | |
) | |
#{"uri": "http://localhost:9000/archive/test1.837p"} | |
self._print(resp) | |
def receive_era(self, uri): | |
resp = r.post('http://localhost:5000/api/receive-era', | |
headers=self.headers, json={"uri": uri}) | |
#{"uri": "http://localhost:9000/archive/test1_input2.835"} | |
self._print(resp) | |
def received_claims(self): | |
resp = r.get('http://localhost:5000/api/get-received-claims', headers=self.headers) | |
self._print(resp) | |
def received_claim(self, id): | |
resp = r.get('http://localhost:5000/api/get-received-claim?received_claim_id=' + id, | |
headers=self.headers) | |
self._print(resp) | |
def translate_837(self, uri): | |
is_institutional = '837i' in uri | |
resp = r.post('http://localhost:5000/api/translate-837', | |
headers=self.headers, json={ | |
"uri": uri, | |
"unescaped": 1, | |
"noSugar": 1, | |
"isInstitutional": is_institutional | |
} | |
) | |
#{"uri": "http://localhost:9000/archive/test1.837p"} | |
print(json.dumps(resp.json(), indent=2)) | |
fn = sys.argv[1].replace('-', '_', 1000) | |
c = Command() | |
getattr(c, fn)(*sys.argv[2:]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment