Sublime Forum

Passing parameters in Sublime REST Client

#1

How would I pass parameters to GET request. I have been reading readme file, but can’t figure out how.

GET https://httpbin.org/

Auth Type: Basic
Username: username
Password: password

0 Likes

#2

Are you using the REQUESTS python library?
requests · PyPI

If so, it can be as simple as this (depending on the authentication method and required response headers):

import requests
r = requests.get('https://httpbin.org/basic-auth/user/pass', auth=('user', 'pass'))

print(r.status_code)
#  200

print(r.headers['content-type'])
# 'application/json; charset=utf8'

print(r.encoding)
# 'utf-8'

print(r.text)
# '{"authenticated": true, ...'

print(r.json())
# {'authenticated': True, ...}

1 Like