'I can't donwload complete genome of Culex pipiens pallens of the ncbi by API (Entrez): HTTP Error 400: Bad Request

I am trying to download the genbank if possible of the complete genome of Culex pipiens pallens from the ncbi but I get this error. The URL of de ncbi. In the db variable that I sent in the fetch I already tried with nucleotide, genome, Gen etc. I thought that with assembly I would download it but no.

When I run the download_genbank() function, I get the error: HTTP Error 400: Bad Request

This is the page: ncbi culex pipiens pallens complete genome:
ncbi culex pipiens pallens complete genome

from pathlib import Path
from Bio               import Entrez
from Bio.Entrez.Parser import DictionaryElement, ListElement
from Bio import SeqIO
from Bio.SeqRecord import SeqRecord
from typing  import Union

def write_text(txt: str, filename: str):

Path(filename).parent.mkdir(parents=True, exist_ok=True)
Path(filename).write_text(txt)

def request_fetch(  db:str,
                id: Union[str, list[str], set[str]],
                file_format: str,
                filename: str                       ):
""" This function writes plain text in the type you specify.
    Typical types: 'fasta', 'gb', etc. 
    Should be used to download only a few files."""

if Path(filename).exists(): return

with Entrez.efetch( db=db,
                    id=id,
                    rettype=file_format,
                    retmode="text"      ) as response:

    content: str = response.read()

write_text(content, filename)


#GCF_016801865.1

def downloand_genbank(): 
request_fetch(      db="assembly",
                    id='GCF_016801865.1',
                    file_format='gb',
                    filename='cache/culex_pipens_pallens.gb') 

download_genbank()


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source