Python Forum
Convert Python 2 to 3 syntax issue
Thread Rating:
  • 2 Vote(s) - 3 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Convert Python 2 to 3 syntax issue
#11
Thanks for that, I'll give it a try.
Reply
#12
If you need quotes, you can use iex:

#!/usr/bin/python3
import requests, json

url = "https://api.iextrading.com/1.0/stock/ibm/quote"
rsp = requests.get(url)
if rsp.status_code in (200,):
    str = rsp.text.strip()
    print(str) # json
    print()
else:
    print("ERROR:", rsp.status_code)
    print(rsp.text + "\n\n")
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  How to convert TransactSQL into Abstract Syntax Tree (AST) using Python? bajrangbs 2 2,306 Jan-30-2020, 03:46 PM
Last Post: micseydel
  Issue with a script to convert xls to json Will86 2 3,807 Dec-19-2018, 08:23 AM
Last Post: Will86
  issue with syntax volcano 12 6,708 Feb-22-2018, 04:43 PM
Last Post: buran

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020