mirror of
https://codeberg.org/mclemens/CloudlogOffline2QRZ.git
synced 2024-09-30 01:57:18 -04:00
added new config item for install_path
This commit is contained in:
parent
ba8910cb87
commit
857e79ca1f
@ -46,7 +46,8 @@ class QRZ():
|
||||
'api_key': '1234-ABCD-1234-A1B2',
|
||||
'url': 'https://logbook.qrz.com/api'}
|
||||
config['general'] = {
|
||||
'api_key': 'API_KEY_FOR_THIS_API'
|
||||
'api_key': 'API_KEY_FOR_THIS_API',
|
||||
'install_path': '/log/'
|
||||
}
|
||||
|
||||
with open(file_name, 'w') as configfile:
|
||||
@ -122,6 +123,8 @@ class QRZ():
|
||||
|
||||
|
||||
class ApiTest(Resource):
|
||||
"""Listens on the API endpoint /api/auth to validate
|
||||
the configured API key in CloudlogOffline"""
|
||||
|
||||
def get(self, key):
|
||||
if key and key == qrz.config['general']['api_key']:
|
||||
@ -132,6 +135,8 @@ class ApiTest(Resource):
|
||||
|
||||
|
||||
class UploadQso(Resource):
|
||||
"""Listens on the API endpoint /api/qso to receive
|
||||
single ADIF strings from CloudlogOffline"""
|
||||
|
||||
def post(self):
|
||||
data = request.json
|
||||
@ -154,12 +159,9 @@ class UploadQso(Resource):
|
||||
)
|
||||
|
||||
|
||||
# adding the defined resources along with their corresponding urls
|
||||
api.add_resource(ApiTest, '/index.php/api/auth/<string:key>' )
|
||||
api.add_resource(UploadQso, '/index.php/api/qso')
|
||||
|
||||
|
||||
# driver function
|
||||
# main
|
||||
if __name__ == '__main__':
|
||||
qrz = QRZ()
|
||||
app.run(debug=True, host='0.0.0.0')
|
||||
api.add_resource(ApiTest, qrz.config['general']['install_path'] + 'index.php/api/auth/<string:key>' )
|
||||
api.add_resource(UploadQso, qrz.config['general']['install_path'] + 'index.php/api/qso')
|
||||
app.run(debug=True)
|
||||
|
Loading…
Reference in New Issue
Block a user