This project began as my final project for my AP Computer Science A course, where we were given the freedom to make anything we wanted, as long as we were exploring an area of computer science that we were not familiar with. While most of my classmates opted to stick to Java, the language that we had been learning throughout the year, and make projects that stayed within the console, I decided to create my project in Python, a language that I had been wanting to learn for a while, and learn how to call upon APIs.
This project utilizes the Spotify and Discord APIs to create a Discord bot that is able to call upon the Spotify API to retrieve information regarding artists or albums that the user specifies using message commands in Discord.
*This preview may not include the full project. All files are uploaded to my GitHub.
""" Full code uploaded to GitHub """ import requests import json import os base_url = 'https://api.spotify.com/v1/' def auth(): cid = os.getenv('SpotifyCID') secret = os.getenv('SpotifyClientSecret') auth_url = 'https://accounts.spotify.com/api/token' r = requests.post(auth_url, { 'grant_type': 'client_credentials', 'client_id': cid, 'client_secret': secret, }) auth_response_data = r.json() access_token = auth_response_data['access_token'] headers = { 'Authorization': 'Bearer {token}'.format(token = access_token) } return headers""" Full code uploaded to GitHub """