Created
June 16, 2019 10:14
-
-
Save M0r13n/24b55f838d085409ca4050a15c1b27aa to your computer and use it in GitHub Desktop.
How to query the hexbot api
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests # install if necessary -> pip install requests | |
URL = 'https://api.noopschallenge.com' + '/hexbot' # change the last part to query different machines | |
r = requests.get(URL) | |
result = r.json() | |
print(result['colors'][0]['value']) # prints the hex code, e.g. #7A5A28 | |
# Additional parameters | |
# Hexbot supports: count, width, height, seed | |
params = {'count': 5, 'width': 1000, 'height': 1000} | |
r = requests.get(URL, params=params) # the requests module will handle the parameter encoding | |
result = r.json() | |
print(result) # prints a list of hexcodes |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment