I’ve worked on more API things that I currently cannot explain clearly, but I started a file for amin search for a fact about elements for science.
And I learned more about github and how “pull request” works. not much to say.
a small glimpse of the file:
import hashlib
import json
import random
import urllib.request
from typing import Optional, List, Dict
# Static JSON of all elements from periodic-table-api (public, no key required)
ELEMENTS_URL = "https://neelpatel05.github.io/periodic-table-api/api/v1/element.json"
DEFAULT_TIMEOUT = 10
# Fallback elements in case the API is unreachable
FALLBACK_ELEMENTS = [
{"name": "Hydrogen", "symbol": "H", "atomicNumber": 1},
{"name": "Helium", "symbol": "He", "atomicNumber": 2},
{"name": "Lithium", "symbol": "Li", "atomicNumber": 3},
{"name": "Carbon", "symbol": "C", "atomicNumber": 6},
{"name": "Oxygen", "symbol": "O", "atomicNumber": 8},
{"name": "Iron", "symbol": "Fe", "atomicNumber": 26},
{"name": "Gold", "symbol": "Au", "atomicNumber": 79},
]