用于GDACS提要的异步GeoRSS客户端库。

aio-georss-gdacs的Python项目详细描述


python aio georss gdacs

Build StatusCoverage StatusPyPiVersion

此库提供对Global Disaster Alert and Coordination System (GDACS)提要的方便异步访问。在

安装

pip install aio-georss-gdacs

使用

有关如何使用此库的示例,请参见下文。在实例化 特定的类-feed或feed manager-并提供所需的参数, 您可以调用update来检索提要数据。返回值 将是状态代码的元组和实际数据的列表形式 特定于选定源的源条目。在

状态代码

  • OK:更新进行得很好,数据被检索到。图书馆可能还会 返回空数据,例如,因为没有条目满足筛选条件 标准。在
  • OK_NO_DATA:更新进行得很好,但是没有检索到任何数据 因为服务器指示自上次请求后没有更新。在
  • ERROR:更新过程中出错

参数

ParameterDescription
^{}Coordinates (tuple of latitude/longitude)

支持的筛选器

^{tb2}$

示例

importasynciofromaiohttpimportClientSessionfromaio_georss_gdacsimportGdacsFeedasyncdefmain()->None:asyncwithClientSession()aswebsession:# Home Coordinates: Latitude: -33.0, Longitude: 150.0# Filter radius: 500 kmfeed=GdacsFeed(websession,(-33.0,150.0),filter_radius=500)status,entries=awaitfeed.update()print(status)print(entries)asyncio.get_event_loop().run_until_complete(main())

源条目属性

每个提要条目都填充以下属性:

NameDescriptionFeed attribute
geometriesAll geometry details of this entry (except bounding boxes).^{}
coordinatesBest coordinates (latitude, longitude) of this entry.^{}
external_idThe unique public identifier for this incident.^{}
titleTitle of this entry.^{}
attributionAttribution of the feed.n/a
distance_to_homeDistance in km of this entry to the home coordinates.n/a
categoryThe alert level of the incident.^{}
descriptionThe description of the incident.^{}
alert_levelAlert level ("Red", "Orange", "Green").^{}
countryCountry where incident happened.^{}
duration_in_weekDuration of the incident in full weeks.^{}
event_idEvent ID (numerical).^{}
event_nameShort event name.^{}
event_type_shortShort event type ("DR, "EQ", "FL", "TC", "TS", "VO").^{}
event_typeLong event type ("Drought", "Earthquake", "Flood", "Tropical Cyclone", "Tsunami", "Volcano").^{}
from_dateDate and time this incident started.^{}
icon_urlIcon URL.^{}
is_currentWhether this incident is current.^{}
populationExposed population.^{}
severitySeverity of the incident.^{}
temporaryWhether this incident is temporary.^{}
to_dateDate and time this incident ended.^{}
versionVersion of the incident in this feed.^{}
vulnerabilityVulnerability score (textual or numerical).^{}

订阅源管理器

Feed管理器通过通知 关于新的提要条目、更新和删除条目的提要的使用者 与上次更新源相比。在

  • 如果当前提要更新是第一次更新,那么所有提要条目都将 报告为新的。feed manager将跟踪所有feed条目' 已成功处理的外部ID。在
  • 如果当前提要更新不是第一次更新,那么提要管理器将 生产三套:
    • 不在上一个源更新中但位于 当前源更新将报告为新的。在
    • 在上一个源更新中,但仍在 当前订阅源更新将被报告为要更新。在
    • 在上一个源更新中但不在 当前源更新将被报告删除。在
  • 如果当前更新失败,则上一次更新中处理的所有提要条目 将报告要删除源更新。在

从提要成功更新后,提要管理器提供两个 不同日期:

  • last_update将是提要上一次更新的时间戳 不管成功与否。在
  • last_update_successful将是上次成功更新的时间戳 从饲料。如果此库的用户需要,此日期可能有用 以不同的方式处理来自feed更新的间歇性错误。在
  • last_timestamp(可选,取决于提要数据)将是最新的 从提要数据中提取的时间戳。 这要求底层feed数据实际上包含一个合适的 日期。如果此库的用户希望,此日期可能有用 如果feed条目实际上没有被更新,则对它们进行不同的处理。在

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java Android:在内部存储器中保存两个同名位图   java如何获取每个月的记录?   java错误:找不到com。安卓工具。构建:渐变:3.2.1   Java反射,如何使用构造函数获取newInstance是一个很重要的问题。类别ex:Class<Customer>customerClass   java具体类不使用泛型标识符编译   java InputStream在Apache FileUpload API中关闭   java自动隐藏任务栏和最大屏幕空间   java端点返回对象而不是直接JSON   java打印BST的直径   在Java中将节点追加到xml   java如何在Jersey中注册静态类?   java如何修改for循环,使其不比较第一个循环和最后一个循环,而是将所有其他循环与最后一个循环进行比较?   java扩展主机意外终止(vscode)   如何使用Java进程读取mysql控制台输出   java从现有列表创建元素列表   java将数据流式传输到BigQuery新表中?   java如何从绑定结果验证失败返回错误响应?