Skip to content

Commit

Permalink
Merge branch 'master' into community
Browse files Browse the repository at this point in the history
  • Loading branch information
bbelderbos committed Oct 4, 2019
2 parents 9196c85 + d10af3f commit 822aaac
Showing 1 changed file with 19 additions and 20 deletions.
39 changes: 19 additions & 20 deletions 64/marvel.py
Original file line number Diff line number Diff line change
@@ -1,35 +1,34 @@
import hashlib # needed for API auth
import json
import json # use dumps and loads
import os
from time import sleep # between API pagination calls

import requests
import requests # call Marvel API

# get from marvel developer account:
public_key = os.environ['PUBLIC_KEY']
private_key = os.environ['PRIVATE_KEY']
PUBLIC_KEY = os.environ['PUBLIC_KEY']
PRIVATE_KEY = os.environ['PRIVATE_KEY']

ENDPOINTS = 'characters comics creators events series stories'.split()
# https://developer.marvel.com/documentation/authorization
# "Authentication for Server-Side Applications" section
ENDPOINT = ('https://gateway.marvel.com:443/v1/public/{endpoint}?ts=1&'
'apikey={public_key}&hash={hash_}')

# https://developer.marvel.com/docs
MARVEL_OBJECTS = 'characters comics creators events series stories'.split()

# recommended prep work

def get_data_from_marvel_api_endpoint(endpoint):
"""Helper function to get data from the Marvel API:
def get_api_endpoint():
"""Helper function to form a valid API endpoint (use ENDPOINT)"""
pass

https://gateway.marvel.com:443/v1/public/{endpoint}

See: https://developer.marvel.com/documentation/authorization
"Authentication for Server-Side Applications" section
-> you will need to hash ts, public and private key, use hashlib
Endpoints: https://developer.marvel.com/docs
Return the response json object.
"""
ts = 1
def cache_marvel_data():
"""Helper function to cache Marvel API JSON data to file"""
pass


if __name__ == '__main__':
your_endpoint = '' # one of ENDPOINTS
get_data_from_marvel_api_endpoint(your_endpoint)
# 1. cache API data
# 2. load JSON file(s) and build awesome graphs
pass

0 comments on commit 822aaac

Please sign in to comment.