Skip to content

Commit

Permalink
Linting
Browse files Browse the repository at this point in the history
  • Loading branch information
bsmartradio committed Aug 16, 2024
1 parent 3710c07 commit 97e9714
Showing 1 changed file with 19 additions and 4 deletions.
23 changes: 19 additions & 4 deletions python/lsst/alert/packet/bin/loadRegistry.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
import lsst.alert.packet



def parse_args():
parser = argparse.ArgumentParser()
parser.add_argument(
Expand All @@ -47,12 +46,13 @@ def parse_args():
)
return parser.parse_args()


def upload_schema(registry_url, subject, schema_registry):
"""Parse schema registry and upload all schemas."""
for version in schema_registry.known_versions:
schema = schema_registry.get_by_version(version)
numbers = re.findall(r'\d+', version)
numbers[1]=str(numbers[1]).zfill(2)
numbers[1] = str(numbers[1]).zfill(2)
version_number = int(''.join(numbers))
normalized_schema = fastavro.schema.to_parsing_canonical_form(
schema.definition)
Expand All @@ -79,12 +79,12 @@ def delete_schema():

# Check the status code
if response.status_code == 200:
print('The schema will be deleted and remade in import mode')
print('The schema will be deleted and remade in import mode.')
response = requests.delete(url_schemas)
print('Status Code:', response.status_code)
print('Response Text:', response.text)
else:
print(f'The schema does not exist. Creating in import mode')
print('The schema does not exist. Creating in import mode.')

# Define the headers
headers = {
Expand Down Expand Up @@ -113,6 +113,21 @@ def main():
subject=args.subject,
schema_registry=schema_registry
)
data = {
"mode": "READWRITE"
}

# Headers to specify the content type
headers = {
'Content-Type': 'application/json'
}

# Send the PUT request
response = requests.put('http://localhost:8081/mode/alert-packet', json=data, headers=headers)

# Print the response status code and text
print(f'Status Code: {response.status_code}')
print(f'Response Text: {response.text}')


if __name__ == "__main__":
Expand Down

0 comments on commit 97e9714

Please sign in to comment.