Fix incosistent use of single and double quotes
This commit is contained in:
@ -5,7 +5,7 @@
|
|||||||
import requests
|
import requests
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
|
||||||
listings = requests.get("https://roisindubh.net/remote/searchlistings.json").json()["results"]
|
listings = requests.get('https://roisindubh.net/remote/searchlistings.json').json()['results']
|
||||||
|
|
||||||
# using several print statements to prioritise code readability over efficiency (I/O speeds are unimportant to me)
|
# using several print statements to prioritise code readability over efficiency (I/O speeds are unimportant to me)
|
||||||
print('<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0">')
|
print('<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0">')
|
||||||
@ -13,24 +13,24 @@ print('<channel><title>Roisín Dubh Listings</title><link>https://roisindubh.net
|
|||||||
|
|
||||||
for listing in listings:
|
for listing in listings:
|
||||||
print('<item>')
|
print('<item>')
|
||||||
print('<title>' + listing["pagetitle"] + '</title>')
|
print('<title>' + listing['pagetitle'] + '</title>')
|
||||||
print('<link>https://roisindubh.net/listings/' + listing["alias"] + '</link>')
|
print('<link>https://roisindubh.net/listings/' + listing['alias'] + '</link>')
|
||||||
|
|
||||||
print('<description> <![CDATA[')
|
print('<description> <![CDATA[')
|
||||||
print(listing["introtext"] + "\n" + listing["content"] + "\n")
|
print(listing['introtext'] + '\n' + listing['content'] + '\n')
|
||||||
|
|
||||||
print('Location: ' + listing["name"] + '<br>')
|
print('Location: ' + listing['name'] + '<br>')
|
||||||
print('Ticket Allocation: ' + listing["ticket_allocation"] + '<br>')
|
print('Ticket Allocation: ' + listing['ticket_allocation'] + '<br>')
|
||||||
print('Tickets remaining?: ' + str(listing["ticket_remaining"] == '1') + '<br>')
|
print('Tickets remaining?: ' + str(listing['ticket_remaining'] == '1') + '<br>')
|
||||||
print('Event start time: ' + listing["event_date_time"] + '<br>')
|
print('Event start time: ' + listing['event_date_time'] + '<br>')
|
||||||
print('Late night?: ' + str(listing["late_night"] == "1") + '<br>')
|
print('Late night?: ' + str(listing['late_night'] == '1') + '<br>')
|
||||||
print('Postponed?: ' + str(listing["postponed"] == "1") + '<br>')
|
print('Postponed?: ' + str(listing['postponed'] == '1') + '<br>')
|
||||||
print('Sales start time: ' + listing["sales_start"] + '<br>')
|
print('Sales start time: ' + listing['sales_start'] + '<br>')
|
||||||
print('On Sale?: ' + str(listing["on_sale"] == "1") + '<br>')
|
print('On Sale?: ' + str(listing['on_sale'] == '1') + '<br>')
|
||||||
print('Tickets remaining?: ' + str(listing["ticket_remaining"] == '1') + '<br>')
|
print('Tickets remaining?: ' + str(listing['ticket_remaining'] == '1') + '<br>')
|
||||||
|
|
||||||
if listing["external_ticket_url"]:
|
if listing['external_ticket_url']:
|
||||||
print('External Ticket URL: <a href="' + listing["external_ticket_url"] + '">' + listing["external_ticket_url"] + '</a>')
|
print('External Ticket URL: <a href="' + listing['external_ticket_url'] + '">' + listing['external_ticket_url'] + '</a>')
|
||||||
|
|
||||||
# unparsed json object:
|
# unparsed json object:
|
||||||
# "prices": {
|
# "prices": {
|
||||||
@ -43,7 +43,7 @@ for listing in listings:
|
|||||||
# },
|
# },
|
||||||
|
|
||||||
print(']]> </description>')
|
print(']]> </description>')
|
||||||
print('<pubDate>' + datetime.strptime(listing["event_date_time"], '%Y-%m-%dT%H:%M:%S').strftime('%a, %d %b %Y %H:%M:%S %z') + '</pubDate>')
|
print('<pubDate>' + datetime.strptime(listing['event_date_time'], '%Y-%m-%dT%H:%M:%S').strftime('%a, %d %b %Y %H:%M:%S %z') + '</pubDate>')
|
||||||
print('</item>')
|
print('</item>')
|
||||||
|
|
||||||
print('</channel></rss>')
|
print('</channel></rss>')
|
||||||
|
Reference in New Issue
Block a user