#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Paresh Prema 22 May 2020 """ USAGE NOTES For details on the submission format required follow the link below https://minorplanetcenter.net/mpcops/documentation/identifications/submission_format/ """ import requests import json url = 'https://minorplanetcenter.net/mpcops/submissions/identifications/' data_file = 'newids.json' with open(data_file,'r') as json_file: data = json.load(json_file) params = data # The payload/params etc can be passed simply using 'json=' in the # POST request. No need to specify headers identifying types # json=params - send json data # data=params send get or post depending on what you specify: # e.g. requests.post # requests.get response = requests.get(url,json=params) # User is able to check status e.g. # 200 is a successful submission print (response.status_code, response.reason) # Further reponse methods can be found here for example # https://2.python-requests.org/en/stable/api/#requests.Response # User can check the message sent back with the following print (response.text)