Coder Social home page Coder Social logo

apis_and_mongo_seattle-ds's Introduction

This repository contains information about using APIs and MongoDB in collecting and storing data. It was designed for pedagogical purposes and began life as a fork of Miles Erickson's repository about APIs. His instructions for registering for the Foursquare API are detailed below.

Foursquare API Example

Register

  • Please register for the Foursquare API and create an app. When you create the app, you can indicate that you're affiliated with Flatiron School and that you're a student.
  • Create a file called .secrets/credentials.json based on .secrets/credentials-example.json
    cd .secrets
    cp credentials-example.json credentials.json
    vim credentials.json  # use your favorite editor to paste in your client ID and client secret
    cd ..
    git status  # credentials.json should not show up because .secrets/ is in .gitignore
    

Review Documentation

Example API Request

import json
import requests

# Load secrets from credentials.json
url = 'https://api.foursquare.com/v2/venues/explore'
with open('.secrets/credentials.json') as f:
    params = json.load(f)
    
params['v'] = '20180323'
params['ll'] = '40.7243,-74.0018',
params['query'] = 'coffee',
params['limit'] = 1

response = requests.get(url=url, params=params)
data = json.loads(response.text)

Installing MongoDB

This can be easier said than done.

Try this first:

In the terminal, run:

brew install mongodb

If that doesn't work, follow the second link below. Please note that the tar and the sudo commands refer to the gzipped tar file that you just downloaded, which includes the version number in its name. The instructions below are from earlier this year and they refer to Version 3.6.1. Adjust this as needed. (When I last installed MongoDB, the version no. was 4.2.1.)

For more on installation, see here and here.

apis_and_mongo_seattle-ds's People

Contributors

gadamico avatar mileserickson avatar

Watchers

 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.