Back to index

python-biopython  1.60
Functions
requires_internet Namespace Reference

Functions

def check

Function Documentation

Definition at line 14 of file requires_internet.py.

00014 
00015 def check():
00016     try:
00017         check.available
00018     except AttributeError:
00019         # I'm going to check for internet availability 
00020         RELIABLE_DOMAIN = "biopython.org"
00021         import socket
00022         try:
00023             socket.getaddrinfo(RELIABLE_DOMAIN,
00024                                80,
00025                                socket.AF_UNSPEC,
00026                                socket.SOCK_STREAM)
00027         except socket.gaierror, x:
00028             check.available = False
00029         else:
00030             check.available = True
00031     if not check.available:
00032         raise MissingExternalDependencyError("internet not available")