# How to extend Galois character?

Let $D_p$ be a decomposition group of $Gal(\overline{\mathbb{Q}}/\mathbb{Q})$ above $p$ (for all $p$) and $I_p$ the inertia group. Let $\chi_p$ be a character of $D_p$, such that $\chi_p$ is trivial for almost all $p$.

Question : Why does there exist a character $\chi$ of $Gal(\overline{\mathbb{Q}}/\mathbb{Q})$ such that $\chi_{|I_p}={\chi_p}_{|I_p}$ for all $p$ ?

This result is used in : Serre, 'Modular forms of weight one and Galois representations'. I suspect that it is a consequence of class field theory, but I don't know so much about it.

I guess you meant to write that $\chi_p|_{I_p}$ is trivial for almost all $p$. Notice that this is not the same as taking characters of $I_p$, since the natural morphism $I_p^{\mathrm{ab}} \rightarrow D_p^{\mathrm{ab}}$ is not injective (the Frobenius "twists" elements of $I_p$).
Local class field theory gives us an isomorphism between $\widehat{\mathbb{Q}_p^{\times}}$ and $D_p^{\mathrm{ab}}$, and the image of $I_p$ in $D_p^{\mathrm{ab}}$ corresponds to $\mathbb{Z}_p^{\times}$, so by taking restrictions to $I_p$ of characters $\chi_p$ of $D_p$ we just give ourselves characters $\eta_p$ of $\mathbb{Z}_p^{\times}$.
Global class field theory gives you an isomorphism between $\mathrm{Gal}(\overline{\mathbb{Q}}/\mathbb{Q})^{\mathrm{ab}}$ and $\mathbb{A}^{\times}/\mathbb{Q}^{\times} \mathbb{R}_{>0} \simeq \prod_p \mathbb{Z}_p^{\times}$ (this last isomorphism is particular to the case where the number field is $\mathbb{Q}$, and it is possible to prove the result you want without appealing to it, but it is very convenient here).
We also have the obvious commutative diagram linking the local and global reciprocity maps, where $D_p^{\mathrm{ab}} \rightarrow \mathrm{Gal}(\overline{\mathbb{Q}}/\mathbb{Q})^{\mathrm{ab}}$ is parallel to $\widehat{\mathbb{Q}_p^{\times}} \rightarrow \mathbb{A}^{\times}/\mathbb{Q}^{\times} \mathbb{R}_{>0}$ (this last arrow is the one obtained from $x_p \mapsto (\ldots, 1, x_p , 1 , \ldots)$), and conviniently, the composition $\mathbb{Z}_p^{\times} \hookrightarrow \widehat{\mathbb{Q}_p^{\times}} \rightarrow \mathbb{A}^{\times}/\mathbb{Q}^{\times} \mathbb{R}_{>0} \simeq \prod_q \mathbb{Z}_q^{\times}$ is the obvious thing.
We now define $\eta$ on $\prod_p \mathbb{Z}_p^{\times}$ by $\eta ( (x_p)_p) = \prod_p \eta_p(x_p)$ (well-defined and continuous thanks to the hypothesis).