Python Rest Call

Hello ,
Im really new and just try to call some basic API calls using Python . But I get an error 404.
Are you guys have an sample Python code to call it ?

This is my code :

import pip._vendor.requests as req

url = “https://mainnet.infura.io/v3/{project_id}

r = req.get(url,auth = (‘project id’,’{project_id}))

print(r.status_code)

Hey @Ordinary_Life, and welcome to the Infura community!

I found a great tutorial on YouTube that walks you through building an example app using Infura and Python - you should be able to use that to get a good start!

Let us know if you have any additional questions as you go through the tutorial.

import requests

headers = {
    # Already added when you pass json= but not when you pass data=
    # 'Content-Type': 'application/json',
}

json_data = {
    'jsonrpc': '2.0',
    'method': 'eth_getBalance',
    'params': [
        '0xc94770007dda54cF92009BFF0dE90c06F603a09f',
        'latest',
    ],
    'id': 1,
}

response = requests.post('https://mainnet.infura.io/v3/f3c095656381439aa1acb1722d9c62f2', headers=headers, json=json_data)