Created
June 25, 2022 16:38
-
-
Save arnobify/c2b547979dcbd3f6c64decb50659db48 to your computer and use it in GitHub Desktop.
bdtickets
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import requests | |
| url = 'https://api.bdtickets.com:20102/v1/coaches/search' | |
| payload = '{"fromStationId":"5ffb5909b086d27be1901df3","toStationId":"5ffb5909b086d27be1901e61","date":"2022-06-30"}' | |
| headers = {'content-type': 'application/json', 'Accept-Charset': 'UTF-8'} | |
| r = requests.post(url, data=payload, headers=headers) | |
| available_buses = r.json()["data"] | |
| #print(len(available_buses)) | |
| flag = False | |
| for bus in available_buses: | |
| if bus["companyName"]=="Desh Travels": | |
| print(bus["date"]) | |
| print(bus["companyName"]) | |
| print(str(bus["availableSeats"]) + "seats available") | |
| print(bus["routeName"]) | |
| print(bus["departureTime"] + " - " + bus["arrivaleTime"]) | |
| print("===========================================\n") | |
| flag=True | |
| if(flag==False): | |
| print("No Desh Travels Bus Available Yet") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment