#๐ getting error in code
9 messages ยท Page 1 of 1 (latest)
@misty linden
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.
well, self.data appears to be None, so why is this error unexpected?
but i am not getting the same on this code
import requests
class Flight:
endpoint = "dfnksfbmfn,kjsdf,m"
def __init__(self):
self.end = self.endpoint
self.response = None
self.data = None
def api_get(self ):
self.response = requests.get(self.end)
self.data = self.response.json()
# print(self.data['prices'])
if 'prices' in self.data:
city_name = [city['city'] for city in self.data['prices']]
print(city_name)
my = Flight()
my.api_get()
@misty linden usually flight deal websites don't want you to scrape them because they make the majority of their money from advertising revenues
i am not using flight deal websites api i am using sheety api for docs to extract city name from the docs
i just used the class name flight
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.
๐ getting error in code