Giter VIP home page Giter VIP logo

9daysofapis's Introduction

9DaysOfAPIs

About

As a SysAdmin who uses Python for automating/simplifying certain tasks, I've always wanted to do more. I by no means claim to be a developer, but enjoy it as a hobby and a way to advance my career. This little project is a way for me to get used making API calls with Python. All of the topics of the APIs are things that I think are interesting or funny.

This project started out at 30 days of APIs, and then 21. However, it was easier to find 9 interesting APIs than 30.

While all of the projects will use argparse for certain variables, keep in mind that it is probably safer to set an environment variable with your API keys.

Activities

Day 1 - NASA Astronomy Photos

nasa-apod.py

Simple CLI app that takes a NASA API key and grabs the APOD for today, or the specified date, and downloads it to the current directory.

Arguments:

[optional] --api-key The api.nasa.gov API key to use. Defaults to DEMO_KEY.

[optional] --date The date to grab the photo from. Defaults to today.

Day 2 - NASA Near Earth Asteroids (NEO)

nasa-asteroids.py

Returns a list of Near Earth Objects on a given date range and notes if they are considered potentially hazardous.

Arguments:

api_key The API key to use.

start_date The start date that the asteroid will be near Earth. example: 2019-07-23

end_date The end date that the asteriod will be near Earth. example: 2019-07-30

Day 3 - Open Weather Maps (OMW)

omw-weather.py

Obtains weather forecast for a given city using a given API key from openweathermap.org

Arguments:

api_key Your OWM API key.

zip_code The zipcode you wish to query about.

Day 4 - Taco Fancy

taco-recipe.py

Gives you a random taco recipe!

Arguments:

NONE!

Day 5 - REST Countries

countries-basicinfo.py

Gives the capital and language(s) of a given country.

country The full name of the country.

Day 6 - FOAAS

foaas-foff.py

Returns a random message from FOAAS that only requires input in the from field.

Arguments:

[OPTIONAL] --signed Who are you?

Day 7 - IP Stack

ipstack-geolocation.py

Returns the geolocation for your current IP address, or a given IP address.

Arguments:

api_key Your IP Stack API key.

[OPTIONAL] --ip The IP address you wish to query. Defaults to your IP address.

Day 8 - DnD5e

dnd5e-spells.py

Grabs information about a given Dungeons and Dragons 5e Spell

Arguments:

spell_name The name of the spell to get information for.

Day 9 - Twilio (Using DnD5e)

twilio-dndspells.py

Grabs information about a given Dungeons and Dragons 5e Spell and texts it to a given number.

Arguments:

spell_name The name of the spell to get information for.") api_key The Twilio API key.") auth_token The Twilio acccount Auth Token.") sender The Twilio phone number to send the SMS message from.") recipient The phone number to send the spell information from.")

Lessons Learned

  • MVP (minimum viable product) is easy and provides a way for quick feedback.
  • If you have to look up documentation or Google something, it's best to know the 'lingo' to know what to look for.
  • I should be writing tests (possibly do 9 days of tests as a companion to this project?).
  • Don't always rely on a demo key.
  • f strings are useful, but ugly.
  • Not all JSON output is meant to be printed as plain text.
  • There's more than one way to skin a cat.
  • I should probably script the API endpoint to scrape possibilities instead of hardcoding them.
  • A lot of software vendors are probably using other APIs -- it's genius really.
  • "free" APIs tend to be slow.
  • It's ALOT easier to use a vendor supported package to make your API calls than it is to form your own requests.
  • I wish I knew about list comprehension before doing this.

9daysofapis's People

Contributors

steaksauce- avatar

Stargazers

 avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.