#๐ get information from json list
47 messages ยท Page 1 of 1 (latest)
@trim vine
Remember to:
- Ask your Python question, not if you can ask or if there's an expert who can help.
- Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
- Explain what you expect to happen and what actually happens.
:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.
so i am currently trying to check a json list for available timeslots
the timeslots get displayed in a json list as timeslots : [] and im trying to check if this changes
So if the array is blank, you want the date or?
i want to check every date and timeslot in the list
and if a timeslots becomes available it changes from empty and i want to extract that information
get the date if the timeslot isnt empty
Alright, let me create that program
thanks a lot
Whats the request if thats fine with you
that wont be possible unfortunately as the request is protected by a unique token
easy
thats the link
but you shouldnt be able to access the data
but its exactly as in the pastebin link above
@trim vine
import requests
# Used pastebin for testing, replace with actual link
data = requests.get("https://paste.pythondiscord.com/raw/VZCQ").json()
open_dates = []
for spot in data:
if spot['timeslots']:
open_dates.append(spot['date'])
# Now, we go through every date with the timeslots not empty
print("Open Days:")
print("------------")
for day in open_dates:
print(f"- {day}")
thank you very much
made my day

Does it work how you want it to?
Your welcome, glad I could help
yeah just tested
I think there is a close thread command
I used the pastebin to get the JSON so I could make sure it worked
@noble lotus , it looks like you have lots of problems.
I have a lot of problems?
And what is it then?
This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.