Hi,
I want to create a python script that download https://api.trafiklab.se/sl/realtid/Get ... 0&key=XXXX
and save it to: C:\inetpub\wwwroot\eg\xml\test.xml
Have anyone any idea how to fix it?
Notice: This forum has been recovered from an old backup, so some content, links, and dates may be outdated. The forum is currently read-only while we restore sign-in and registration functionality. Details
If you find this forum valuable and would like to help keep it online, donations to help cover hosting and domain costs are greatly appreciated, but never expected. You can support the forum through Buy Me a Coffee or Ko-fi. Thank you for helping preserve the EventGhost community.
If you find this forum valuable and would like to help keep it online, donations to help cover hosting and domain costs are greatly appreciated, but never expected. You can support the forum through Buy Me a Coffee or Ko-fi. Thank you for helping preserve the EventGhost community.
Download webpage
- Pako
- Plugin Developer
- Posts: 2294
- Joined: Sat Nov 11, 2006 1:31 pm
- Location: Czech Republic
- Contact:
Re: Download webpage
I'm not sure I understand.zetat wrote:Have anyone any idea how to fix it?
I thought the "FIX" is used when something is broken.
However, try to use the action "Python Script" with the following code:
Code: Select all
import codecs
import urllib
url = r"https://api.trafiklab.se/sl/realtid/GetDpsDepartures.xml?siteId=4239&timeWindow=30&key=XXXX"
filePath = r"C:\inetpub\wwwroot\eg\xml\test.xml"
page = urllib.urlopen(url).read().decode('utf8')
file = codecs.open(filePath, 'w', 'utf8')
file.write(page)
file.close()