Trying to scrape stock price using BeautifulSoup from bloomberg and keep getting the value None ...

Denied boarding although I have proper visa and documentation. To whom should I make a complaint?

What would be the ideal power source for a cybernetic eye?

How does the math work when buying airline miles?

Do I really need recursive chmod to restrict access to a folder?

Why are the trig functions versine, haversine, exsecant, etc, rarely used in modern mathematics?

Is it cost-effective to upgrade an old-ish Giant Escape R3 commuter bike with entry-level branded parts (wheels, drivetrain)?

Does classifying an integer as a discrete log require it be part of a multiplicative group?

Fantasy story; one type of magic grows in power with use, but the more powerful they are, they more they are drawn to travel to their source

Is it a good idea to use CNN to classify 1D signal?

When the Haste spell ends on a creature, do attackers have advantage against that creature?

How to write this math term? with cases it isn't working

If a VARCHAR(MAX) column is included in an index, is the entire value always stored in the index page(s)?

How can I use the Python library networkx from Mathematica?

What is implied by the word 'Desika'

Using et al. for a last / senior author rather than for a first author

How do I find out the mythology and history of my Fortress?

また usage in a dictionary

Why didn't Eitri join the fight?

Is this homebrew Lady of Pain warlock patron balanced?

Why aren't air breathing engines used as small first stages?

How to deal with a team lead who never gives me credit?

Is it common practice to audition new musicians one-on-one before rehearsing with the entire band?

How to react to hostile behavior from a senior developer?

Old style "caution" boxes



Trying to scrape stock price using BeautifulSoup from bloomberg and keep getting the value None



Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern)





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}







0












$begingroup$


from bs4 import BeautifulSoup
import requests

def getstockprice(url):
res = requests.get(url)
soup = BeautifulSoup(res.text, 'html.parser')
elems = soup.select_one('.priceText_1853e8a5')
print(elems)

price = getstockprice('https://www.bloomberg.com/quote/NKE:US')
print ('the stock price is' + str(price))

<span class="priceText__1853e8a5">88.73</span>


I'm trying to pull the stock price of a stock through a simple script but I'm having trouble pulling it up as it always comes up as the value None. Any ideas? I included the html class I've been trying to use to select it via beautifulsoup.









share







New contributor




adam mendoza is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.







$endgroup$



















    0












    $begingroup$


    from bs4 import BeautifulSoup
    import requests

    def getstockprice(url):
    res = requests.get(url)
    soup = BeautifulSoup(res.text, 'html.parser')
    elems = soup.select_one('.priceText_1853e8a5')
    print(elems)

    price = getstockprice('https://www.bloomberg.com/quote/NKE:US')
    print ('the stock price is' + str(price))

    <span class="priceText__1853e8a5">88.73</span>


    I'm trying to pull the stock price of a stock through a simple script but I'm having trouble pulling it up as it always comes up as the value None. Any ideas? I included the html class I've been trying to use to select it via beautifulsoup.









    share







    New contributor




    adam mendoza is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.







    $endgroup$















      0












      0








      0





      $begingroup$


      from bs4 import BeautifulSoup
      import requests

      def getstockprice(url):
      res = requests.get(url)
      soup = BeautifulSoup(res.text, 'html.parser')
      elems = soup.select_one('.priceText_1853e8a5')
      print(elems)

      price = getstockprice('https://www.bloomberg.com/quote/NKE:US')
      print ('the stock price is' + str(price))

      <span class="priceText__1853e8a5">88.73</span>


      I'm trying to pull the stock price of a stock through a simple script but I'm having trouble pulling it up as it always comes up as the value None. Any ideas? I included the html class I've been trying to use to select it via beautifulsoup.









      share







      New contributor




      adam mendoza is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.







      $endgroup$




      from bs4 import BeautifulSoup
      import requests

      def getstockprice(url):
      res = requests.get(url)
      soup = BeautifulSoup(res.text, 'html.parser')
      elems = soup.select_one('.priceText_1853e8a5')
      print(elems)

      price = getstockprice('https://www.bloomberg.com/quote/NKE:US')
      print ('the stock price is' + str(price))

      <span class="priceText__1853e8a5">88.73</span>


      I'm trying to pull the stock price of a stock through a simple script but I'm having trouble pulling it up as it always comes up as the value None. Any ideas? I included the html class I've been trying to use to select it via beautifulsoup.







      html parsing web-scraping beautifulsoup





      share







      New contributor




      adam mendoza is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.










      share







      New contributor




      adam mendoza is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.








      share



      share






      New contributor




      adam mendoza is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      asked 3 mins ago









      adam mendozaadam mendoza

      1




      1




      New contributor




      adam mendoza is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.





      New contributor





      adam mendoza is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






      adam mendoza is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






















          0






          active

          oldest

          votes












          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "196"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });






          adam mendoza is a new contributor. Be nice, and check out our Code of Conduct.










          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodereview.stackexchange.com%2fquestions%2f217657%2ftrying-to-scrape-stock-price-using-beautifulsoup-from-bloomberg-and-keep-getting%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          adam mendoza is a new contributor. Be nice, and check out our Code of Conduct.










          draft saved

          draft discarded


















          adam mendoza is a new contributor. Be nice, and check out our Code of Conduct.













          adam mendoza is a new contributor. Be nice, and check out our Code of Conduct.












          adam mendoza is a new contributor. Be nice, and check out our Code of Conduct.
















          Thanks for contributing an answer to Code Review Stack Exchange!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          Use MathJax to format equations. MathJax reference.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodereview.stackexchange.com%2fquestions%2f217657%2ftrying-to-scrape-stock-price-using-beautifulsoup-from-bloomberg-and-keep-getting%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          is 'sed' thread safeWhat should someone know about using Python scripts in the shell?Nexenta bash script uses...

          How do i solve the “ No module named 'mlxtend' ” issue on Jupyter?

          Pilgersdorf Inhaltsverzeichnis Geografie | Geschichte | Bevölkerungsentwicklung | Politik | Kultur...