Python Forum
How to use data from an API, to create an alert?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to use data from an API, to create an alert?
#9
I worked it out!

import requests
import json

response = requests.get('https://a.4cdn.org/biz/catalog.json')
catalog = json.loads(response.text)

for page in catalog:
    threads = page['threads']
    for thread in threads:
        no = thread["no"]
        try:
            sub = thread["sub"]
            if 'doge' not in sub:
                pass
            else:
                print(no)
        except:
            pass

        try:
            com = thread["com"]
            if 'doge' not in com:
                pass
            else:
                print(no)
        except:
            continue
this prints out the numbers I want, now I just need to work out the second part which is emailing myself the results as a link.
snippsat likes this post
Reply


Messages In This Thread
RE: How to use data from an API, to create an alert? - by PopFendi - Apr-22-2021, 02:21 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Monitor specific line of code and get alert Olimpiarob 0 1,539 Jul-08-2020, 10:06 AM
Last Post: Olimpiarob
  Python / Selenium Turning Off Alert graham23s 3 8,296 Aug-18-2019, 02:12 PM
Last Post: metulburr
  Issue closing an Modal Alert (popup) leviathan54 8 5,944 Apr-23-2019, 02:00 PM
Last Post: leviathan54

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020