Web scraping data from a Spotfire web report

0 votes

I was reading about Web Scraping using Python in this post:
https://www.edureka.co/blog/web-scraping-with-python/

Currently I have to daily go open the Spotfire web report select some filters and manually type the data in an excel document,

I am trying to automatically grab the data from a Sportfire Web Report, specific data in a label over a chart for example. 

(not exporting data sheet or table) Just the specific values under a certain fields in the report

But I can't find the way to apply this method or if this is the best solution to it, someone knows a way to do this?

Jun 26, 2020 in Python by anonymous
• 120 points
218 views

1 answer to this question.

0 votes

Hi, @There,

You can try this: It reads data from a web service and saves the data as a data table into the analysis.

import clr
clr.AddReference('System.Net')
from System.IO import *
from System.Net import HttpWebRequest, NetworkCredential
from Spotfire.Dxp.Data.Import import TextFileDataSource, TextDataReaderSettings

req = HttpWebRequest.Create("http://server-port/fileName.csv")

user_agent = 'individual user-agent'
req.Method = "GET"
req.UseDefaultCredentials = True


readerSettings = TextDataReaderSettings()
readerSettings.Separator = ","
readerSettings.CultureName = "en-GB"

rsp = req.GetResponse()
dSource = TextFileDataSource(rsp.GetResponseStream(),readerSettings)

tblfound="false"
for table in Document.Data.Tables:
		if table.Name == "dataFromWebService":
			tblfound = "true"
if tblfound == "false":
	Document.Data.Tables.Add("dataFromWebService",dSource)
if tblfound == "true":
	Document.Data.Tables["dataFromWebService"].ReplaceData(dSource)

rsp.Close ();
answered Jun 30, 2020 by Gitika
• 65,870 points

Related Questions In Python

0 votes
2 answers

Extracting data from a JSON file in Python

Here is what i found and was ...READ MORE

answered Nov 27, 2018 in Python by Rupali
26,669 views
0 votes
1 answer

How to read data from a text file using Python?

Refer to the below example where the ...READ MORE

answered May 12, 2019 in Python by Sushma
557 views
0 votes
1 answer

How to check if a website allows web scraping?

To check if a website allows web ...READ MORE

answered Jun 14, 2019 in Python by Wajiha
• 1,950 points
8,043 views
0 votes
1 answer

How I do get the data from the <font> tag from a given tr tag?

This should work: from bs4 import BeautifulSoup html_doc='''<tr id="tr_m_1570:240HJY" ...READ MORE

answered Sep 18, 2019 in Python by Omkar
• 69,130 points
220 views
0 votes
2 answers
+1 vote
2 answers

how can i count the items in a list?

Syntax :            list. count(value) Code: colors = ['red', 'green', ...READ MORE

answered Jul 6, 2019 in Python by Neha
• 330 points

edited Jul 8, 2019 by Kalgi 2,033 views
0 votes
0 answers
0 votes
1 answer

I want to download a file from the website by web scraping. Can anyone explain how to do this in jupyter lab (python) with an example?

Hey, Web scraping is a technique to automatically ...READ MORE

answered Apr 7, 2020 in Python by Gitika
• 65,870 points
667 views
0 votes
3 answers

How to get the return value from a thread using python?

FWIW, the multiprocessing module has a nice interface for ...READ MORE

answered Dec 15, 2020 in Python by Roshni
• 10,440 points
59,915 views