import time
import tweepy
import json
import requests

# Twitter Dev Tokens
auth = tweepy.OAuthHandler("NbRCVzJt3XHOEemFMws6depjP", "<KEY>")
auth.set_access_token("<KEY>", "<KEY>")

# token <PASSWORD>
# Bakersfield = "https://api.waqi.info/feed/california/kern/bakersfield-california-avenue/?keyword=bakersfield&token=<PASSWORD>"

request_result = requests.get("https://api.waqi.info/feed/california/kern/bakersfield-california-avenue/?keyword=bakersfield&token=<PASSWORD>")
request_json = request_result.json()
airq = request_json["data"]["aqi"]

# Create API object
api = tweepy.API(auth)

#Time Stamp
localtime = time.asctime(time.gmtime())
update = "Hello, today is {}, and the air quality for Bakersfield is {}.".format(localtime, airq)

#sleep timer 

time.sleep(480)

# update = "Hello, today is", localtime , "and the air quality is", Bakersfield"

api.update_status(update)


