Skip to content

Instantly share code, notes, and snippets.

@oshliaer
Last active August 29, 2015 14:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save oshliaer/eb8d7197e6749475652a to your computer and use it in GitHub Desktop.
Save oshliaer/eb8d7197e6749475652a to your computer and use it in GitHub Desktop.
#marvel #python
# #!/usr/bin/python
# -*- coding: utf-8 -*-
import time
import hashlib
import urllib.parse
import urllib.request
q = {}
q['ts'] = str(time.time())
q['apikey'] = '{Your_public_key}'
q['name'] = 'Spider-Man'
privateKey = '{Your_private_key}'
q['hash'] = hashlib.md5(bytes(q['ts'] + privateKey + q['apikey'], 'utf-8')).hexdigest()
params = urllib.parse.urlencode(q)
url = 'http://gateway.marvel.com/v1/public/characters?%s' % params
with urllib.request.urlopen(url) as f:
print(f.read())
# #!/usr/bin/python
# -*- coding: utf-8 -*-
import time
import hashlib
import urllib.parse
import urllib.request
q = {}
q['ts'] = str(time.time())
q['apikey'] = '{Your_public_key}'
privateKey = '{Your_private_key}'
q['hash'] = hashlib.md5(bytes(q['ts'] + privateKey + q['apikey'], 'utf-8')).hexdigest()
params = urllib.parse.urlencode(q)
url = 'http://gateway.marvel.com/v1/public/characters?%s' % params
with urllib.request.urlopen(url) as f:
print(f.read())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment