Trying to connect to a ServiceNow instance and pull information from the tables. I am using the aiosnow module. Here is the code:
import asyncio
import getpass
import aiosnow
from aiosnow.models.table.declared import IncidentModel as Incident
# Get user input
instanceSN = input("Enter the instance name: ")
usernameSN = input("Enter your ServiceNow username: ")
passwordSN = getpass.getpass()
async def main():
client = aiosnow.Client(instanceSN, basic_auth=(usernameSN,passwordSN))
async with Incident(client, table_name="incident") as inc:
query = aiosnow.select(
Incident.assigned_to.starts_with(<insert username>)
).order_asc(Incident.priority)
for response in await inc.get(query, limit=5):
print("Attaching [readme.txt] to {number} ({sys_id})".format(**response))
await inc.upload_file(response["sys_id"], path="./readme.txt")
asyncio.run(main())
When I run this I get the following error message: aiosnow.exceptions.ClientConnectionError: Cannot connect to host servicenow.example.com:443 ssl:default [The semaphore timeout period has expired]