Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gis.admin.usage_reports.generate_report() failing unexpectedly with "Specified output format not supported" #2145

Open
knoopum opened this issue Oct 28, 2024 · 0 comments
Labels

Comments

@knoopum
Copy link

knoopum commented Oct 28, 2024

Describe the bug
When attempting to run gis.admin.usage_reports.generate_report(), it fails unexpectedly with "Specified output format not supported" for certain report types. It appears to fail for "content", "activity", "credits", and "serviceUsages", while it appears to succeed for "user"; "itemUsages" fails differently with "invalid timeAggregate value"

The output format error appears to be an old bug (BUG-000142494), which indicates that it is not reproducible in the "current version" of the ArcGIS API for Python; however, that is not the case for me. This error occurs on multiple recent versions of the API, including 2.3.0.3 and 2.4.0.

To Reproduce
Steps to reproduce the behavior:

import arcgis
from arcgis import GIS

# ArcGIS API for Python version:
print('ArcGIS API for Python version:', arcgis.__version__)

# Connect to default GIS.
gis = GIS("home")  

# Generate a weekly credit report
report_job = gis.admin.usage_reports.generate_report(
    report_type = 'credits',
    title = 'test',
    duration = 'weekly',
    future = False
)

error:

---------------------------------------------------------------------------
Exception                                 Traceback (most recent call last)
/tmp/ipykernel_241/1627142702.py in <cell line: 0>()
      9 
     10 # Generate a weekly credit report
---> 11 report_job = gis.admin.usage_reports.generate_report(
     12     report_type = 'credits',
     13     title = 'test',

/opt/conda/lib/python3.11/site-packages/arcgis/gis/admin/_usage.py in generate_report(self, focus, report_type, title, duration, start_time, notify, future)
    154             params["startTime"] = start_time
    155         count = 0
--> 156         resp = self._con.post(url, params)
    157         if "itemId" in resp and future:
    158             from arcgis._impl._async.jobs import ItemStatusJob

/opt/conda/lib/python3.11/site-packages/arcgis/gis/_impl/_con/_connection.py in post(self, path, params, files, **kwargs)
   1524         if return_raw_response:
   1525             return resp
-> 1526         return self._handle_response(
   1527             resp=resp,
   1528             out_path=out_path,

/opt/conda/lib/python3.11/site-packages/arcgis/gis/_impl/_con/_connection.py in _handle_response(self, resp, file_name, out_path, try_json, force_bytes, ignore_error_key)
    999                     return data
   1000                 errorcode = data["error"]["code"] if "code" in data["error"] else 0
-> 1001                 self._handle_json_error(data["error"], errorcode)
   1002             return data
   1003         else:

/opt/conda/lib/python3.11/site-packages/arcgis/gis/_impl/_con/_connection.py in _handle_json_error(self, error, errorcode)
   1022 
   1023         errormessage = errormessage + "\n(Error Code: " + str(errorcode) + ")"
-> 1024         raise Exception(errormessage)
   1025 
   1026     def post_multipart(

Exception: Specified output format not supported.
(Error Code: 400)

Expected behavior
I would expect the generation of the report to succeed with the parameters provided.

Platform (please complete the following information):

  • OS: Windows 11
  • Browser: Chrome
  • Python API Version(s): 2.3.0.3 and 2.4.0 (at least)
@knoopum knoopum added the bug label Oct 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant