0

https://mor.nlm.nih.gov/RxNav/search?searchBy=NDC&searchTerm=51079045120

how to get RXCUI number from this website in python, I am unable to get

content = driver.page_source
soup = BeautifulSoup(content, 'html.parser')
cont = soup.findAll("div", {"id": "titleHolder"})
rx = cont.find("span", id = "rxcuiDecoration")
print(rx.text)
1
  • Just in addition - In newer code avoid old syntax findAll() instead use find_all() - For more take a minute to check docs Commented Jun 7, 2022 at 7:20

1 Answer 1

1

The site renders using javascript you have to use the API

import requests 

r = requests.get('https://rxnav.nlm.nih.gov/REST/ndcstatus.json?caller=RxNav&ndc=51079045120')

print(r.json()['ndcStatus']['rxcui'])
Sign up to request clarification or add additional context in comments.

2 Comments

Thank You for this, can you also please the tell that how to get "Ingredients and Strength" values from status section of that mor.nlm.nih.gov/RxNav/…

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.