kaisero / fireREST

Python library for interacting with Cisco Firepower Management Center REST API
GNU General Public License v3.0
70 stars 49 forks source link

422 Client Error on FMC 6.2.2 #58

Closed netman2048 closed 2 years ago

netman2048 commented 2 years ago

I'm trying to use this on an older FMC to pull data from to build a new FMC on 6.7 code. When I try to create the FMC object, I get a 422 client error, but I can connect to the new FMC just fine. I'm thinking it is an issue with the older FMC version and the API it presents. I did confirm the REST API is enabled on the old server.

Here is the error I get:

Traceback (most recent call last):
  File "C:\Python39\lib\site-packages\fireREST\utils.py", line 188, in wrapper
    response.raise_for_status()
  File "C:\Users\xxx\AppData\Roaming\Python\Python39\site-packages\requests\models.py", line 953, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 422 Client Error: Unprocessable Entity for url: https://10.90.192.38/api/fmc_platform/v1/auth/generatetoken

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Python39\lib\site-packages\fireREST\__init__.py", line 43, in __init__
    self.conn = Connection(hostname, username, password, protocol, verify_cert, domain, timeout, dry_run)
  File "C:\Python39\lib\site-packages\fireREST\fmc\__init__.py", line 74, in __init__
    self.login()
  File "C:\Python39\lib\site-packages\fireREST\fmc\__init__.py", line 232, in login
    response = self._request('post', url, auth=self.cred)
  File "C:\Python39\lib\site-packages\decorator.py", line 232, in fun
    return caller(func, *(extras + args), **kw)
  File "C:\Python39\lib\site-packages\retry\api.py", line 73, in retry_decorator
    return __retry_internal(partial(f, *args, **kwargs), exceptions, tries, delay, max_delay, backoff, jitter,
  File "C:\Python39\lib\site-packages\retry\api.py", line 33, in __retry_internal
    return f()
  File "C:\Python39\lib\site-packages\fireREST\utils.py", line 198, in wrapper
    raise_for_status(response)
  File "C:\Python39\lib\site-packages\fireREST\utils.py", line 246, in raise_for_status
    raise exceptions.get(status_code, exc.GenericApiError)(
fireREST.exceptions.UnprocessableEntityError: The Payload size is above:0 Bytes
kaisero commented 2 years ago

The first supported release for FireREST is 6.6.0, theoretically a lot of stuff should work in previous versions but I have no plans to backport fixes to EoL releases. I am open to pull requests if they do not break existing functionality.

netman2048 commented 2 years ago

OK no problem.... I'll probably just pull what I need with requests myself then use your repo to create stuff in the new. Thanks!