Skip to content
Snippets Groups Projects
Select Git revision
  • 9467c96f9fb7a1b5bc88072c0ab92eb8e1173d29
  • master default protected
  • gitkeep
  • dev protected
  • Issue/2309-docs
  • Issue/2373-fixPagination
  • Heinrichs-master-patch-93799
  • devops-aczepiel
  • Hotfix/2097-fixTimeFormat
  • Hotfix/2087-efNet6
  • Issue/1910-MigrationtoNET6.0
  • Issue/1964-tokenExpiryUIv2
  • Sprint/2022-01
  • Sprint/2021-11
  • Sprint/2021-08
  • Hotfix/1262-fixStatuscode
  • Sprint/2021-05
  • Product/1100-fdsS3
  • Topic/1292-FdsS3
  • Product/1188-LoggingExtended
  • Topic/1221-LogginExtendedNew
  • v2.2.3
  • v2.2.2
  • v2.2.1
  • v2.2.0
  • v2.1.3
  • v2.1.2
  • v2.1.1
  • v2.1.0
  • v2.0.2
  • v2.0.1
  • v2.0.0
  • v1.12.0
  • v1.11.0
  • v1.10.0
  • v1.9.1
  • v1.9.0
  • v1.8.0
  • v1.7.3
  • v1.7.2
  • v1.7.1
41 results

LoggingMiddleware.cs

Blame
  • Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    main.py 948 B
    import sys
    from datetime import datetime, timezone
    
    from requests import HTTPError
    
    from utils import get_existing_results, save_results
    
    
    def main(analytics_token):
        try:
            # Get existing results
            existing_results = get_existing_results(analytics_token)
    
            h5p_result = existing_results["count_h5p_statements"]
            moodle_result = existing_results["count_moodle_statements"]
    
            print(h5p_result, moodle_result)
    
            # Built results array
            results = [
                {
                    "column1": "h5p",
                    "column2": h5p_result["result"][0]["column2"],
                },
                {"column1": "moodle", "column2": moodle_result["result"][0]["column2"]},
            ]
    
            # Send result to rights engine
            save_results(analytics_token, results)
        except HTTPError as error:
            print(error.response.status_code, error.response.text)
    
    
    if __name__ == "__main__":
        main(sys.argv[1])