There are two issues here: one of definitions and one of code.
First, the value you're expecting to get here -- 1361 Watts per square meter, the solar constant -- is the total flux received from the Sun at 1 AU, i.e. on Earth. Here, you've set the distance at 1 parsec; since that's larger by a factor of $\sim10^5$, this swap has decreased your answer by a factor of $\sim10^{10}$!
The code-related problem likely has to do with how the wavelength integral$^{\dagger}$ is being computed by integrate.quad
. $B_{\lambda}(\lambda, T)$ peaks at visible wavelengths (which you can show via Wien's law), at a few hundred nanometers. The main contribution to the integral is within an order of magnitude or so from this range. However, you've set the upper and lower limits of the integral to $0$ and $2\times10^{10}$ meters, respectively. integrate.quad
is evaluating $B_{\lambda}(\lambda, T)$ on some grid of wavelength values, and with the range you've picked, the vast majority of points on that grid are outside the range of relevant wavelengths, at which the Planck function is effectively 0.
(One way you can check this is to reduce the upper limit to, say, $10^5$ meters so that more of your grid points are at wavelengths closer to the range of interest. You should see that, counterintuitively, decreasing the upper limit causes the value your code spits out to increase.)
There are several ways you could go about addressing this (changing the limits, for example, or doing a logarithmic change-of-variables as suggested by David Z), but the simplest solution would be to not have your code do the integration at all. The integral of $B_{\lambda}(\lambda, T)$ over all wavelengths has an analytical solution; after we integrate over all wavelengths and solid angles, we get
$$L=\int d\Omega\;\cos(\theta)\int B_{\lambda}(\lambda, T)\;d\lambda=\sigma T^4$$
with $\sigma$ the Stefan-Boltzmann constant. This avoids the numerical problems you've run into.
$^{\dagger}$We also need to integrate $B_{\lambda}(\lambda, T)$ over all solid angles, but I see your code implicitly does this by multiplying by $4\pi^2$, since the Planck function is isotropic.