Biopython-HTTP错误403:禁止-NCBIWWW.qblast

时间:2018-07-25 19:28:44

标签: python https biopython blast ncbi

我正在尝试从Biopython中使NCBIWWW.qblast模块正常工作,但是无论我做什么,我都会收到“ HTTP错误403:禁止访问”

针对Stack Overflow上类似问题的其他答案无法解决问题。这是由于HTTP还是HTTP?关于正在发生的事情或如何解决的任何想法?

例如:

from Bio.Blast import NCBIWWW
from Bio import SeqIO
record = SeqIO.read("myseq.fa", format="fasta")
result_handle = NCBIWWW.qblast("blastn", "nt", record.seq)

---------------------------------------------------------------------------
HTTPError                                 Traceback (most recent call last)
<ipython-input-398-78612c6e3a6f> in <module>()
      2 from Bio import SeqIO
      3 record = SeqIO.read("myseq.fa", format="fasta")
----> 4 result_handle = NCBIWWW.qblast("blastn", "nt", record.seq)

~/anaconda/lib/python3.6/site-packages/Bio/Blast/NCBIWWW.py in qblast(program, database, sequence, auto_format, composition_based_statistics, db_genetic_code, endpoints, entrez_query, expect, filter, gapcosts, genetic_code, hitlist_size, i_thresh, layout, lcase_mask, matrix_name, nucl_penalty, nucl_reward, other_advanced, perc_ident, phi_pattern, query_file, query_believe_defline, query_from, query_to, searchsp_eff, service, threshold, ungapped_alignment, word_size, alignments, alignment_view, descriptions, entrez_links_new_window, expect_low, expect_high, format_entrez_query, format_object, format_type, ncbi_gi, results_file, show_overview, megablast)
    120                        message,
    121                        {"User-Agent": "BiopythonClient"})
--> 122     handle = _urlopen(request)
    123 
    124     # Format the "Get" command, which gets the formatted results from qblast

~/anaconda/lib/python3.6/urllib/request.py in urlopen(url, data, timeout, cafile, capath, cadefault, context)
    221     else:
    222         opener = _opener
--> 223     return opener.open(url, data, timeout)
    224 
    225 def install_opener(opener):

~/anaconda/lib/python3.6/urllib/request.py in open(self, fullurl, data, timeout)
    530         for processor in self.process_response.get(protocol, []):
    531             meth = getattr(processor, meth_name)
--> 532             response = meth(req, response)
    533 
    534         return response

~/anaconda/lib/python3.6/urllib/request.py in http_response(self, request, response)
    640         if not (200 <= code < 300):
    641             response = self.parent.error(
--> 642                 'http', request, response, code, msg, hdrs)
    643 
    644         return response

~/anaconda/lib/python3.6/urllib/request.py in error(self, proto, *args)
    568         if http_err:
    569             args = (dict, 'default', 'http_error_default') + orig_args
--> 570             return self._call_chain(*args)
    571 
    572 # XXX probably also want an abstract factory that knows when it makes

~/anaconda/lib/python3.6/urllib/request.py in _call_chain(self, chain, kind, meth_name, *args)
    502         for handler in handlers:
    503             func = getattr(handler, meth_name)
--> 504             result = func(*args)
    505             if result is not None:
    506                 return result

~/anaconda/lib/python3.6/urllib/request.py in http_error_default(self, req, fp, code, msg, hdrs)
    648 class HTTPDefaultErrorHandler(BaseHandler):
    649     def http_error_default(self, req, fp, code, msg, hdrs):
--> 650         raise HTTPError(req.full_url, code, msg, hdrs, fp)
    651 
    652 class HTTPRedirectHandler(BaseHandler):

HTTPError: HTTP Error 403: Forbidden

0 个答案:

没有答案