You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.
|
- import hashlib
- import requests
- import time
-
-
- def main():
- with open("api-keys", "r") as file:
- lines = file.readlines()
- assert len(lines) == 2, "Incorrect api-keys file"
- public_key = lines[0].strip()
- private_key = lines[1].strip()
-
-
- url = "http://gateway.marvel.com/v1/public/comics"
- params = dict()
- params["apikey"] = public_key
- ts = str(time.time())
- to_hash = ts + private_key + public_key
- hasher = hashlib.md5()
- hasher.update(to_hash.encode())
- digest = hasher.hexdigest()
- params["ts"] = ts
- params["hash"] = digest
- response = requests.get(url, params=params)
- print(response.status_code)
- print(response.text)
-
-
- if __name__ == "__main__":
- main()
|