Bottom Page

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 Scrap a value from website
#1
Iam trying scrap trade date value -- below is what i have written, but not getting the value. Can someone help on this.

#!/usr/bin/env python
import urllib2, json
ua = { 'User-Agent' : 'Mozilla/5.0' }
request = urllib2.Request('http://www.cmegroup.com/CmeWS/mvc/TimeandSales/300/G/N8?timeSlot=16&entryDate=20180522&pageNumber=1&_=1527157308610', headers=ua)
response = urllib2.urlopen(request)
data = json.loads(response.read())
response.close()
print data['tradeDate']
Quote
#2
Use Requests,and stop using Python 2.
import requests

url = 'https://www.cmegroup.com/CmeWS/mvc/TimeandSales/300/G/N8?timeSlot=16&entryDate=20180522&pageNumber=1&_=1527157308610'
response = requests.get(url).json()
Output:
>>> response {'entries': [], 'productDescription': 'Corn Futures Jul 2028 Globex', 'props': {'pageNumber': 1, 'pageSize': 100, 'pageTotal': 0}, 'tradeDate': '-'} >>> response['tradeDate'] '-'
Quote

Top Page

Possibly Related Threads...
Thread Author Replies Views Last Post
  Scrap a dynamic span hefaz 0 577 Mar-07-2020, 02:56 PM
Last Post: hefaz
  scrap by defining 3 functions zarize 0 260 Feb-18-2020, 03:55 PM
Last Post: zarize
  Skipping anti-scrap zarize 0 309 Jan-17-2020, 11:51 AM
Last Post: zarize
  Cannot get selenium to scrap past the first two pages newbie_programmer 0 959 Dec-12-2019, 06:19 AM
Last Post: newbie_programmer
  Scrap data from not standarized page? zarize 4 600 Nov-25-2019, 10:25 AM
Last Post: zarize
  page impossible to scrap? :O zarize 2 838 Oct-03-2019, 02:44 PM
Last Post: zarize
  Scrap text out of td table from URLS Gochix2020 4 1,267 Aug-03-2019, 02:56 AM
Last Post: Larz60+
  scrap macrotrends mr_byte31 7 2,017 Aug-02-2019, 12:02 AM
Last Post: mr_byte31
  Scrap arbitrage odds -help Gochix2020 3 637 Jul-31-2019, 10:45 AM
Last Post: Gochix2020
  i am trying to web scrap this .asp nufan0000 1 500 May-30-2019, 02:27 AM
Last Post: Larz60+

Forum Jump:


Users browsing this thread: 1 Guest(s)