ServiceNow pack PySnow library deprecation warnings

Hello! New to the forum and to Stackstorm, so please forgive any faux pas. I appreciate any guidance about etiquette and rules, as appropriate. :slight_smile:

I’m using the ServiceNow pack from Stackstorm Exchange with version 3.2.0 of Stackstorm and whenever I run most any action, the PySnow library that it’s based on returns a deprecation warning:

  "stderr": "/opt/stackstorm/virtualenvs/servicenow/lib/python2.7/site-packages/pysnow/ DeprecationWarning: `query` is deprecated and will be removed in a future release. Please use `resource()` instead.
  \"Please use `resource()` instead.\" % inspect.stack()[1][3], DeprecationWarning)
/opt/stackstorm/virtualenvs/servicenow/lib/python2.7/site-packages/pysnow/ DeprecationWarning: get_all() is deprecated, please use get_multiple() instead
  warnings.warn(\"get_all() is deprecated, please use get_multiple() instead\", DeprecationWarning)
  "exit_code": 0

I was considering forking the pack and adding a configuration parameter for the /api/now/ “version” for the ServiceNow API and then updating the pack action Python methods to call the “newer” methods based on the configuration parameter (i.e., “strategy” pattern). Would that be the appropriate approach? (Of course, I would submit a pull request for the updated code to share with community. I just wasn’t sure of philosophy.)

Tim Jones

Welcome to the StackStorm Forum!

Forking the pack and creating a PR to update the dependency and updating the code to call more modern methods is exactly the right approach. Thank you for giving back to the community!

Feel free to ask questions here, or in the #community channel on our Slack community:

1 Like

Perfect! Thanks so much for your response. I will follow this approach.