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?
#2
UPDATE:

found a good video that explained lists and dictionaries quite well here

this is where I'm at so far.

import requests
import json

def search(threads, lookup1):
    number = ['no']
    for k, v in threads.items():
        try:
            if lookup1 in v:
                return number

        except:
            continue

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

for page in catalog:
    thread = page['threads']
    for threads in thread:
        search(threads, 'DOGE')
the function I've added is mostly guess work at this point, but i've managed to loop through the list of pages and I can print each individual "thread" dict now. I'm using 'DOGE' as an example keyword as mine are hardly ever mentioned, but still no luck actually returning any data.
Reply


Messages In This Thread
RE: How to use data from an API, to create an alert? - by PopFendi - Apr-20-2021, 07:58 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Monitor specific line of code and get alert Olimpiarob 0 1,540 Jul-08-2020, 10:06 AM
Last Post: Olimpiarob
  Python / Selenium Turning Off Alert graham23s 3 8,300 Aug-18-2019, 02:12 PM
Last Post: metulburr
  Issue closing an Modal Alert (popup) leviathan54 8 5,946 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