Skip to content

A1aef/rail

Repository files navigation

title description tags
Rails Starter
A Rails starter app using a PostgreSQL database
ruby
rails
postgresql

Rails Starter Example

This is a Ruby on Rails starter app that connects to a Railway Postgres database and supports Action Cable.

Deploy on Railway

✨ Features

  • Ruby
  • Rails
  • Postgres
  • Redis

💁‍♀️ How to use

📝 Notes

This app was generated with the rails new command. Read more about Rails on their official websiteok

import requests import json

def fetch_earthquake_data(): # USGS API for past day's all earthquake data url = "https://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/all_day.geojson"

# Send a HTTP request to the URL
response = requests.get(url)

# If request is successful, status code will be 200
if response.status_code == 200:
    # Get the content of the response
    data = response.content
    
    # Parse JSON data
    earthquakes = json.loads(data)
    
    # Print earthquake data
    for earthquake in earthquakes["features"]:
        print(f"Magnitude: {earthquake['properties']['mag']}, Location: {earthquake['properties']['place']}")
else:
    print(f"Failed to fetch earthquake data, status code: {response.status_code}")

fetch_earthquake_data()

About

Aaron's learning exp

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •