PubChemPy
PubChemPy copied to clipboard
Broken services or IP ban
Hi I am trying to get pubchem id for about 3k smiles, I worked one by one but was very slow, so I programmed a simple multi threading loop to get them a little faster, but it did work very well and now the service seems to be down I am getting PubChemHTTPError: 'Service Unavailable'
Hi Stephane, do you mind sharing your loop code? I have minimal programming experience. I need to do something similar to yours, but I get an error (an internal server error). The following text loop doesn't work.
with open ("""directory/file.txt""") as f: ... for line in f: ... pcp.get_compounds(line, 'inchi', as_dataframe=True, searchtype='identity', identity_type='same_connectivity') ... time.sleep(0.5) ... if ' ' in line: ... break
But the following works fine:
with open("""directory/testfile.txt""") as f: ... for line in f: ... print (line) ... time.sleep(0.5) ... if ' ' in line: ... break
prints InChIs in the testfile.txt one at a time with 0.5 seconds delay after each line.
Thanks! -Moein