Skip to content

hackatbrown/api-starter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

api-starter

Hi, this is the API starter pack, a crash course to get you up and running with APIs if this is your first time working with them!

What You'll Learn

  • What APIs are and how to use them (in PDF)
  • How to use API keys securely (in PDF)
  • How to send and receive data using Python (template.py)
  • How to make requests with the Pokemon API
  • How to build a simple chatbot using the OpenAI API and a weather app using the Weather API (Jupyter notebooks)

What is an API?

API stands for Application Programming Interface — a way for two software systems to talk to each other.
For example:

  • The Weather API gives you the temperature when you send it a city name.
  • The OpenAI API gives you a text response when you send it a message.
  • The Pokemon API gives you Pokémon stats, abilities, and other data when you send it a Pokémon name.

You send a request, and get back a response (usually in JSON).


How to Get API Keys

API keys are unique strings that identify you when you make requests to an API. They act as a password between your application and the API server.

You'll typically store API keys in a .env file to keep them private and load them into your Python scripts using python-dotenv.

To get an API key:

  1. Go to the API's website and create an account
  2. After signing in, navigate to the API keys or developer settings section
  3. Generate a new API key and copy it
  4. Store it securely in your .env file (never commit API keys to version control!)

Setup Instructions

  1. Clone this repository:

    git clone https://github.com/<your-username>/api-starter.git
    cd api-starter
  2. Create and activate a virtual environment:

    python3 -m venv venv
    source venv/bin/activate      # For Mac/Linux
    venv\Scripts\activate         # For Windows
  3. Install dependencies:

    pip install -r requirements.txt
  4. Create your environment file:

    cp .env.example .env

    Then open the .env file and add your API keys.

  5. Try out any of the example notebooks (Weather App, Pokemon, OpenAI) and use the template file!

NOTE: You must active and deactive your virtual enviornment whenever you are working with these python files.

  • To activate:
    source venv/bin/activate      # For Mac/Linux
    venv\Scripts\activate         # For Windows
  • To deactivate:
    deactivate

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •