Exemplo n.º 1
0
            timestamp = int(time.time())

            t.track_unstruct_event(SelfDescribingJson(
                "iglu:au.com.oneflare/weather_info/jsonschema/1-0-0",
                {
                    'weather_dateTime': convertTimezone(lc['timeZone'], get_detail_once(fc_w, 'dateTime')),
                    'location_id': lc['id'],
                    'lat': lc['lat'],
                    'lon': lc['lng'],
                    'suburb': lc['name'],
                    'postcode': lc['postcode'],
                    'region': lc['region'],
                    'state': lc['state'],
                    'location_timeZone': lc['timeZone'],
                    'weather_issueTime': convertTimezone(lc['timeZone'], get_detail_once(fc_w, 'issueDateTime')),
                    #'rainfall_issueTime': convertTimezone(lc['timeZone'], get_detail_once(fc_r, 'issueDateTime')),
                    'rainfall_issueTime': convertTimezone(lc['timeZone'], get_detail_once(fc_o, 'issueDateTime')),
                    'precis': get_detail_once(fc_w, 'precis'),
                    'precisCode': get_detail_once(fc_w, 'precisCode'),
                    'precisOverlayCode': get_detail_once(fc_w, 'precisOverlayCode'),
                    'temp_max': get_detail_once(fc_w, 'max'),
                    'temp_min': get_detail_once(fc_w, 'min'),
                    'rainfall_since9AMAmount': get_detail_once(fc_o, 'since9AMAmount'),
                    'rainfall_dayAmount': get_detail_once(fc_o, 'todayAmount')
                    #,
                    #'rainfall_probability': get_detail_once(fc_r, 'probability'),
                    #'rainfall_startRange': get_detail_once(fc_r, 'startRange'),
                    #'rainfall_endRange': get_detail_once(fc_r, 'endRange')
                }
            ), None, int(timestamp))

            weather_object.append(obj)
Exemplo n.º 2
0
# manually send time stamp as getting "Long" int every time..
timestamp = int(time.time())

# run over all entries
for key in rss2["entries"]:
    print("get entry...")

    # to get all the terms for the entry and make it into a list
    for idx, val in enumerate(rss2["entries"]):
        if 'tags' in rss2["entries"][idx]:
            # create temp list
            termList = []
            for key2 in rss2["entries"][idx]["tags"]:
                termList.append(key2["term"])

    # send unstruc news event
    print("send entry to snowplow..")
    t.track_unstruct_event(SelfDescribingJson(
        "iglu:au.com.oneflare/news/jsonschema/1-0-0",
        {
            "title": key['title'],
            "tags": termList,
            "publication_date": getTime(key["published"], True),
            "geo_state": "NSW",
            "geo_country": "AU",
            "link": key["link"],
            "date_imported": getTime(rss2.modified, False)
        }
    ), None, int(timestamp))