Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

py scrapy

import time
import webbrowser
import requests
from datetime import datetime

found = False
while not found:
    today = datetime.today()
    try:
        r = requests.get(url = API_URL)
        data = r.json()
        next_slot = datetime.strptime(data['next_slot'], '%Y-%m-%d')
        print(f'Next slot: {next_slot}')
        if((next_slot - today).days < 1):
            webbrowser.open(URL)
            found = True
        else:
            time.sleep(10)
    except KeyError:
        continue
Comment

PREVIOUS NEXT
Code Example
Python :: python list remove all elements 
Python :: python official documentation 
Python :: pandas to excel 
Python :: package python 
Python :: reduce () in python 
Python :: python find lcm 
Python :: python list tutorial 
Python :: sklearn.metrics accuracy_score 
Python :: how to store a return value in a variable in python 
Python :: list comprehension odd numbers python 
Python :: DtypeWarning: Columns (7) have mixed types. Specify dtype option on import or set low_memory=False 
Python :: shallow copy deep copy python 
Python :: python dictionary accessing an element 
Python :: rabbitmq python 
Python :: self python 
Python :: multiplication in python 
Python :: docstring python 
Python :: how to remove trailing zeros in python 
Python :: how to slice string in python 
Python :: pandas change column order 
Python :: how to make a calcukatir un python 
Python :: return programming 
Python :: ten minute mail 
Python :: excelwriter python 
Python :: pyhton mcq 
Python :: na in python 
Python :: robot framework log from python 
Python :: How to sum a column in Python csv 
Python :: self._ in python 
Python :: import CreateAPIView django 
ADD CONTENT
Topic
Content
Source link
Name
8+5 =