Skip to content

Instantly share code, notes, and snippets.

@krvajal
Created March 23, 2017 23:31
Show Gist options
  • Save krvajal/df4397e5667c13d25f642a1a65a2925c to your computer and use it in GitHub Desktop.
Save krvajal/df4397e5667c13d25f642a1a65a2925c to your computer and use it in GitHub Desktop.
# Install the Python Requests library:
# `pip install requests`
import requests
def send_request():
# My API
# GET https://api.invertironline.com/api/micuenta/estadocuenta
try:
response = requests.get(
url="https://api.invertironline.com/api/micuenta/estadocuenta",
headers={
"Authorization": "Basic YWNvbGxhZG8xOTkyOioqKioqIEhpZGRlbiBjcmVkZW50aWFscyAqKioqKg==",
},
)
print('Response HTTP Status Code: {status_code}'.format(
status_code=response.status_code))
print('Response HTTP Response Body: {content}'.format(
content=response.content))
except requests.exceptions.RequestException:
print('HTTP Request failed')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment