GithubHelp home page GithubHelp logo

itglue-py's People

Contributors

b-loyola avatar davidhaymond avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

itglue-py's Issues

itglue.connection.Connection.ResponseError: (422, '{"errors":[{"status":422,"title":"Cannot index flexible assets without providing a flexible asset type ID filter","source":{"pointer":null}}]}')

I've been trying to lookup flexible assets via the API and receive a 422 error either direct via urllib or with this module:

>>> itglue.FlexibleAsset.get()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/itglue/resources.py", line 186, in get
    data = cls._process_request(connection.get, parent=parent)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/itglue/resources.py", line 303, in _process_request
    return request_func(path, **request_args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/itglue/connection.py", line 34, in get
    response = self._process_request(requests.get, url, params=params)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/itglue/connection.py", line 80, in _process_request
    raise self.ResponseError(response.status_code, response.text)
itglue.connection.Connection.ResponseError: (422, '{"errors":[{"status":422,"title":"Cannot index flexible assets without providing a flexible asset type ID filter","source":{"pointer":null}}]}')

Any idea what's missing?

Updating resources doesn't overwrite original values

When trying to update a resource (e.g. configuration), adding keys like "configuration_status_id" it's being treated as a new attribute in the class since the return of the existing configuration has a key of "configuration-status-id". With python 3.0, the orders of the keys when adding to the dictionary is preserved, so it is updated with the new values, however with previous python versions (e.g. v 2.7), this is not the case.

We should update all the returned API results with underscores before returning the class.

E.g.

<Configuration id: 41080, attributes: {u’contact-id’: None, u’updated-at’: u'2018-08-23T00:21:57.000Z’, u’organization-name’: u’EC2 Test’, u’warranty-expires-at’: None, u’model-name’: None, u’serial-number’: u’i-00d5ef80d40ee2abd’, u’asset-tag’: None, ‘configuration_type_id’: u'6147', u’location-id’: 30530, ‘location_id’: u'30530', ‘configuration_status_id’: u'606', u’configuration-type-id’: 6147, u’purchased-by’: None, u’operating-system-notes’: None, u’restricted’: False, u’hostname’: None, u’installed-at’: None, u’adapter-sync-statuses’: None, u’default-gateway’: None, ‘mac_address’: ‘02:0e:ab:03:62:06’, ‘serial_number’: ‘i-00d5ef80d40ee2abd’, u’psa-integration’: None, u’mac-address’: u'02:0e:ab:03:62:06', u’manufacturer-name’: None, u’location-name’: u’us-west-2a’, ‘purchased_at’: ‘2018-08-23’, u’manufacturer-id’: None, u’organization-id’: 36656, u’operating-system-id’: None, u’model-id’: None, u’configuration-type-name’: u’EC2', u’operating-system-name’: None, u’my-glue’: False, u’contact-name’: None, u’name’: ‘testing’, u’configuration-status-name’: u’Active’, u’resource-url’: u’https://lisa.staging.itglue.com/36656/configurations/41080', u’primary-ip’: u'172.31.20.122', u’purchased-at’: u'2018-08-23', u’created-at’: u'2018-08-23T00:18:12.000Z’, u’installed-by’: None, u’configuration-status-id’: 283, u’position’: None, u’organization-short-name’: None, u’notes’: ‘private_dns_name: \tip-172-31-20-122.us-west-2.compute.internal\ninstance_type: \tt2.micro\nkey_name: \titg-dev-ec2-test\navailability_zone: \tus-west-2a\nimage_id: \tami-6cd6f714\npublic_dns_name: \t\nsecurity_groups: \tlaunch-wizard-4’}>

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.