We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Do you happen to have python example?
I've had good success connecting but cant figure out how to query
I'm getting a 401 error
import requests import hashlib import hmac import time import uuid import json sqlRestURL = "http://localhost:5050" apiKey = bytes('sqlrestTestKey', 'utf-8') def createHmac(message): hash = hmac.new(apiKey, message, hashlib.sha256) return hash.hexdigest() def setAuthHeader(options, message=bytes('', encoding='utf8')): realm = "testing-func" hmac = createHmac(message) nonce = uuid.uuid4().hex timestamp = int(round(time.time() * 1000)) options['Authorization'] = f"{realm}:{hmac}:{nonce}:{timestamp}" return options def connect(): url = sqlRestURL + "/connect" options = {} auth_headers = setAuthHeader(options) r=requests.get(url, headers=auth_headers) print(r.status_code) print(r.json()) def query(): url = sqlRestURL + "/v1/query" options = {"Content-Type": "application/json"} payload = {'query': 'SELECT TOP 3 * FROM Flights.dbo.Airlines'} auth_headers = setAuthHeader(options, bytes(json.dumps(payload), encoding='utf8')) r=requests.post(url, headers=auth_headers, data=payload) print(r.status_code) print(r.json())
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Do you happen to have python example?
I've had good success connecting but cant figure out how to query
I'm getting a 401 error
The text was updated successfully, but these errors were encountered: