Name | sn-restapi-wrapper JSON |
Version |
1.1.2
JSON |
| download |
home_page | None |
Summary | A wrapper for ServiceNow RestAPI to pull large data volumes from different tables based on a time period |
upload_time | 2024-07-01 15:26:16 |
maintainer | None |
docs_url | None |
author | Mihindu Perera |
requires_python | None |
license | MIT |
keywords |
wrapper
servicenow-restapi
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# sn_restapi_wrapper
### About
This package acts as a wrapper for ServiceNow RESTAPI application enabling a user to extract data from any table within ServiceNow within a particular time duration, ideally as a date-time format.
The package overcomes the standard limitation of the ServiceNow RESTAPI by using a function of offset, with a rate limit of 5000 and then iterating over the users given time duration. To speed the efficiency of the package threading is used to execute tasks concurrently within the same process for a given time duration- where the tasks are split by the date.
### Installation
Install the package into your env using ```pip install sn-restapi-wrapper```
### Requirements
The core-package requires these applications to be present at minimum
1. requests
2. pandas
3. concurrent.futures
4. tqdm
### Usage
#### Standard Query - Without filters
```python
# ServiceNow credentials instance URL and endpoint
instance_url = 'https://xxx.service-now.com' # Replace with specified url
endpoint = '/api/now/table/xxx' # Replace with table name [incident, incident_task, ...]
# Replace 'username' and 'password' with ServiceNow credentials
username = 'xxx'
password = 'xxx'
# Import the sn_restapi_wrapper as srw
import sn_restapi_wrapper as srw
# Example usage:
# Specify a list of field names to extract
fields = []
# Important: specify fields names used in the backed system. If no fields are mentioned as a list all fields will be pulled but be more time consuming.
# Important: specify start/end date and start/end time within specified format
start_date = 'yyyy-mm-dd'
end_date = 'yyyy-mm-dd'
start_time = 'HH:mi:ss'
end_time = 'HH:mi:ss'
date_field = 'xxx' # Ensure the date field is properly specified e.g 'sys_created_on'
# Pulling data into a pandas dataframe
data = srw.fetch_filtered_data(
instance_url,
endpoint,
date_field,
start_date,
end_date,
start_time,
end_time,
username,
password,
fields
)
# Examine data frame
data.shape
```
#### Custom Query - With filters
```python
# ServiceNow credentials instance URL and endpoint
instance_url = 'https://xxx.service-now.com' # Replace with specified url
endpoint = '/api/now/table/xxx' # Replace with table name [incident, incident_task, ...]
# Replace 'username' and 'password' with ServiceNow credentials
username = 'xxx'
password = 'xxx'
# Import the sn_restapi_wrapper as srw
import sn_restapi_wrapper as srw
# Example usage:
# Specify a list of field names to extract
fields = []
# Important: specify fields names used in the backed system. If no fields are mentioned as a list all fields will be pulled but be more time consuming.
# Important: specify start/end date and start/end time within specified format
start_date = 'yyyy-mm-dd'
end_date = 'yyyy-mm-dd'
start_time = 'HH:mi:ss'
end_time = 'HH:mi:ss'
date_field = 'xxx' # Ensure the date field is properly specified e.g 'sys_created_on'
filter = 'xxxxxxx' # Ensure additional filter is specified
# Pulling data into a pandas dataframe fetch_filtered_data_custom for filtered data
data = srw.fetch_filtered_data_custom(
instance_url,
endpoint,
date_field,
start_date,
end_date,
start_time,
end_time,
username,
password,
fields,
additional_filter=filter
)
# Examine data frame
data.shape
```
### License
This project is licensed under the MIT License. However, this doesnot include the ServiceNow RestAPI which is the sole property of ServiceNow. This is only a wrapper for the ServiceNow RestAPI.
### Contact
For support, please contact mihinduperera35@gmail.com
# Change Log
=============================
1.0.0 (2024-06-20)
------------------
- First release for pre-release testing
1.0.1 (2024-06-20)
------------------
- Second release for pre-release model with updated README.md with use case
1.0.2 (2024-06-20)
------------------
- Third release for pre-release model with updated README.md with use case
1.0.3 (2024-06-20)
------------------
- Fourth release for pre-release model with updated README.md with use case
1.0.4 (2024-06-20)
------------------
- Fifth release for pre-release model with updated README.md with use case
1.1.0 (2024-07-01)
------------------
- First release for standard (previous pre-release) and custom query application with updated README.md with use case
1.1.1 (2024-07-01)
------------------
- First release for standard (previous pre-release) and custom query application (correction) with updated README.md with use case
1.1.2 (2024-07-01)
------------------
- First release for standard (previous pre-release) and custom query application (correction) with updated README.md with use case
Raw data
{
"_id": null,
"home_page": null,
"name": "sn-restapi-wrapper",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": "wrapper, servicenow-restapi",
"author": "Mihindu Perera",
"author_email": "mihinduperera35@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/30/37/33337d8725393631870893fa0a31b5079263bef5146ec7970552c311e108/sn_restapi_wrapper-1.1.2.tar.gz",
"platform": null,
"description": "# sn_restapi_wrapper \r\n\r\n### About \r\n\r\nThis package acts as a wrapper for ServiceNow RESTAPI application enabling a user to extract data from any table within ServiceNow within a particular time duration, ideally as a date-time format. \r\n\r\nThe package overcomes the standard limitation of the ServiceNow RESTAPI by using a function of offset, with a rate limit of 5000 and then iterating over the users given time duration. To speed the efficiency of the package threading is used to execute tasks concurrently within the same process for a given time duration- where the tasks are split by the date.\r\n\r\n### Installation \r\nInstall the package into your env using ```pip install sn-restapi-wrapper```\r\n\r\n### Requirements\r\nThe core-package requires these applications to be present at minimum\r\n1. requests \r\n2. pandas \r\n3. concurrent.futures\r\n4. tqdm \r\n\r\n### Usage\r\n\r\n#### Standard Query - Without filters\r\n```python\r\n# ServiceNow credentials instance URL and endpoint\r\ninstance_url = 'https://xxx.service-now.com' # Replace with specified url\r\nendpoint = '/api/now/table/xxx' # Replace with table name [incident, incident_task, ...]\r\n\r\n# Replace 'username' and 'password' with ServiceNow credentials\r\nusername = 'xxx' \r\npassword = 'xxx'\r\n\r\n# Import the sn_restapi_wrapper as srw \r\nimport sn_restapi_wrapper as srw\r\n\r\n# Example usage:\r\n\r\n# Specify a list of field names to extract\r\nfields = []\r\n\r\n# Important: specify fields names used in the backed system. If no fields are mentioned as a list all fields will be pulled but be more time consuming.\r\n\r\n# Important: specify start/end date and start/end time within specified format\r\nstart_date = 'yyyy-mm-dd'\r\nend_date = 'yyyy-mm-dd'\r\nstart_time = 'HH:mi:ss'\r\nend_time = 'HH:mi:ss'\r\ndate_field = 'xxx' # Ensure the date field is properly specified e.g 'sys_created_on'\r\n\r\n# Pulling data into a pandas dataframe\r\ndata = srw.fetch_filtered_data(\r\n\tinstance_url, \r\n\tendpoint, \r\n\tdate_field, \r\n\tstart_date, \r\n\tend_date, \r\n\tstart_time, \r\n\tend_time, \r\n\tusername, \r\n\tpassword, \r\n\tfields\r\n)\r\n\r\n# Examine data frame\r\ndata.shape\r\n```\r\n#### Custom Query - With filters\r\n```python\r\n# ServiceNow credentials instance URL and endpoint\r\ninstance_url = 'https://xxx.service-now.com' # Replace with specified url\r\nendpoint = '/api/now/table/xxx' # Replace with table name [incident, incident_task, ...]\r\n\r\n# Replace 'username' and 'password' with ServiceNow credentials\r\nusername = 'xxx' \r\npassword = 'xxx'\r\n\r\n# Import the sn_restapi_wrapper as srw \r\nimport sn_restapi_wrapper as srw\r\n\r\n# Example usage:\r\n\r\n# Specify a list of field names to extract\r\nfields = []\r\n\r\n# Important: specify fields names used in the backed system. If no fields are mentioned as a list all fields will be pulled but be more time consuming.\r\n\r\n# Important: specify start/end date and start/end time within specified format\r\nstart_date = 'yyyy-mm-dd'\r\nend_date = 'yyyy-mm-dd'\r\nstart_time = 'HH:mi:ss'\r\nend_time = 'HH:mi:ss'\r\ndate_field = 'xxx' # Ensure the date field is properly specified e.g 'sys_created_on'\r\nfilter = 'xxxxxxx' # Ensure additional filter is specified\r\n\r\n# Pulling data into a pandas dataframe fetch_filtered_data_custom for filtered data\r\ndata = srw.fetch_filtered_data_custom(\r\n\tinstance_url, \r\n\tendpoint, \r\n\tdate_field, \r\n\tstart_date, \r\n\tend_date, \r\n\tstart_time, \r\n\tend_time, \r\n\tusername, \r\n\tpassword, \r\n\tfields,\r\n\tadditional_filter=filter\r\n)\r\n\r\n# Examine data frame\r\ndata.shape\r\n```\r\n### License\r\nThis project is licensed under the MIT License. However, this doesnot include the ServiceNow RestAPI which is the sole property of ServiceNow. This is only a wrapper for the ServiceNow RestAPI.\r\n\r\n### Contact\r\nFor support, please contact mihinduperera35@gmail.com\r\n\r\n# Change Log\r\n\r\n=============================\r\n\r\n1.0.0 (2024-06-20)\r\n------------------\r\n- First release for pre-release testing \r\n\r\n1.0.1 (2024-06-20)\r\n------------------\r\n- Second release for pre-release model with updated README.md with use case\r\n\r\n1.0.2 (2024-06-20)\r\n------------------\r\n- Third release for pre-release model with updated README.md with use case\r\n\r\n1.0.3 (2024-06-20)\r\n------------------\r\n- Fourth release for pre-release model with updated README.md with use case\r\n\r\n1.0.4 (2024-06-20)\r\n------------------\r\n- Fifth release for pre-release model with updated README.md with use case\r\n\r\n1.1.0 (2024-07-01)\r\n------------------\r\n- First release for standard (previous pre-release) and custom query application with updated README.md with use case\r\n\r\n1.1.1 (2024-07-01)\r\n------------------\r\n- First release for standard (previous pre-release) and custom query application (correction) with updated README.md with use case\r\n\r\n1.1.2 (2024-07-01)\r\n------------------\r\n- First release for standard (previous pre-release) and custom query application (correction) with updated README.md with use case\r\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "A wrapper for ServiceNow RestAPI to pull large data volumes from different tables based on a time period",
"version": "1.1.2",
"project_urls": null,
"split_keywords": [
"wrapper",
" servicenow-restapi"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "303733337d8725393631870893fa0a31b5079263bef5146ec7970552c311e108",
"md5": "fe758e6f8ef0ba30bc48f7849b37bf2d",
"sha256": "0e8e0ed77ab50a0d1a567d74cf440fc88690289c5104b87c460814f7dbe8be84"
},
"downloads": -1,
"filename": "sn_restapi_wrapper-1.1.2.tar.gz",
"has_sig": false,
"md5_digest": "fe758e6f8ef0ba30bc48f7849b37bf2d",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 4953,
"upload_time": "2024-07-01T15:26:16",
"upload_time_iso_8601": "2024-07-01T15:26:16.326794Z",
"url": "https://files.pythonhosted.org/packages/30/37/33337d8725393631870893fa0a31b5079263bef5146ec7970552c311e108/sn_restapi_wrapper-1.1.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-07-01 15:26:16",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "sn-restapi-wrapper"
}