File: update_networks.py

package info (click to toggle)
python-eth-utils 5.3.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,140 kB
  • sloc: python: 5,985; makefile: 238
file content (24 lines) | stat: -rw-r--r-- 677 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
"""
Script that syncs networks JSON with the current list of networks on chainid.network

Update the networks_file by running this script:

.. code-block:: shell

    $ python update_networks.py

After running the command, check the output in the networks_file.
If all looks good, open a PR with the changes.
"""

import urllib.request

networks_file = "./eth_utils/__json/eth_networks.json"

with urllib.request.urlopen("https://chainid.network/chains_mini.json") as response:
    content = response.read().decode()

with open(networks_file, "w") as open_file:
    open_file.write(f"{content}\n")

print("Networks have updated! Please review and open a PR with the changes.")