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 :: reverse the order of list elements 
Python :: python how to find index of an element in a 2d list 
Python :: bulk upload with dictionary or list in django moels 
Python :: how to keep old content when using write in python 
Python :: configparser error reading relative file path 
Python :: pyjone location 
Python :: sum elements array with step numy 
Python :: int var def __init__(self,var=10): Initialize.var=var def display(): print var 
Python :: somebody please get rid of my annoying-as-hell sunburn!!! 
Python :: how to load multiple list of dictionary values which is stored in python file and load into another python file in python over loop 
Python :: how to get a mouse press not hold in pygame 
Python :: what should I do when the keras image datagenerato is nit working 
Python :: rename a variable using .format in python 
Python :: how to set time.sleep(2) on instapy 
Python :: compile and train cnn models 
Python :: save file in windows hidden folder python 
Python :: zen of python source code 
Python :: sequencia de fibonacci python 
Python :: query dict immuteable 
Python :: Get Dates Between Two Ranges 
Python :: how to add another timestamp column plus two hours 
Python :: alberi binari di ricerca python 
Python :: python seperate int into digit array 
Python :: sort dictionary by values 
Python :: how to insert ele in python 
Python :: get first element of each group 
Python :: python exe restart 
Python :: pd.to_excel header char vertical 
Python :: unittest run one test 
Python :: Find Factors of a Number using While Loop with validation 
ADD CONTENT
Topic
Content
Source link
Name
7+4 =