Skip to content

Instantly share code, notes, and snippets.

@gmariette
Last active November 13, 2020 20:09
Show Gist options
  • Select an option

  • Save gmariette/87d58905b244e627e8ab569069097c7e to your computer and use it in GitHub Desktop.

Select an option

Save gmariette/87d58905b244e627e8ab569069097c7e to your computer and use it in GitHub Desktop.
import requests
import logging
from bs4 import BeautifulSoup
import argparse
import datetime
parser = argparse.ArgumentParser()
parser.add_argument('-v', '--verbose', action='count', default=0)
args = parser.parse_args()
# # Setting the default log to info
# # Configuring the output formatter
logging.basicConfig(level=[logging.WARNING, logging.INFO, logging.DEBUG][min(args.verbose, 2)], format='%(asctime)s - %(name)s - %(levelname)s - %(message)s')
# # Get the current date
tomorrow = datetime.datetime.now() + datetime.timedelta(days=1)
year, month, day = tomorrow.year, tomorrow.month, tomorrow.day
logging.debug("day: %s, month: %s, year: %s", day, month, year)
current_date = str(year) + '-' + str(month) + '-' + str(day)
# # ################### MATCH OF THE DAY ###################
# # Get matchs of the day +1
url = 'https://www.tennisexplorer.com/matches/?type=atp-single&year={}&month={}&day={}'.format(year, month, day)
logging.debug("URL : %s", url)
# # Launch the request
response = requests.get(url)
logging.debug("Response content: %s", response.content)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment