Protein molar mass from Uniprot ID?
You don't need any external library, it's enough to query Uniprot and extract the data you want from the response.

Here an example in Python 3:

from urllib.request import urlopen

id = "P42212"
data = urlopen("http://www.uniprot.org/uniprot/" + id + ".txt").read().decode()
result = data.split('SQ   ')[-1] #here all the info you need
mw = int(result.split(';')[1].strip().split()[0]) #extract the molecular weigth
print(mw)


If you want to batch query a lot of sequences then I suggest to sleep(0.5) after each query to avoid problems with their server.

Update

As correctly pointed out by @Jerven (see comment below), you can query the mass directly.

In this case, the code is the following:

from urllib.request import urlopen

id = "P42212"
data = urlopen("http://www.uniprot.org/uniprot/?query=id:{}&amp;format=tab&amp;columns=id,mass".format(id)).read().decode()
result = data.split('\n')[1].replace(',','')
mw = int(result.split('\t')[-1])
print(mw)