Skip to content

Instantly share code, notes, and snippets.

@remyleone
Created March 14, 2018 09:43
Show Gist options
  • Select an option

  • Save remyleone/08242746faf4252a835faed0eaf86c22 to your computer and use it in GitHub Desktop.

Select an option

Save remyleone/08242746faf4252a835faed0eaf86c22 to your computer and use it in GitHub Desktop.
"""
Testing for account API
"""
import os
import requests
token = os.getenv('SCW_TOKEN', "Insert your API Token here if you don't want to define environment variable")
def test_get_token():
"""
This will give you the token available for your account.
"""
r = requests.get("https://account.scaleway.com/tokens",
headers={'X-Auth-Token': token,
"Content-Type": "application/json"})
print(r.text)
assert r.ok
def test_post_token():
r = requests.post("https://account.scaleway.com/tokens",
headers={'X-Auth-Token': token,
"Content-Type": "application/json"})
print(r.text)
assert r.ok
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment