package
stringlengths 1
122
| pacakge-description
stringlengths 0
1.3M
|
---|---|
aiofutures | AiofuturesGeneral informationInstallationUsageImplicit initialization (global executor)Explicit initializationUVLoopNotesContributionGeneral informationaiofuturesprovides tools to integrate an asynchronous code into your synchronous
application in a usual and easy way using standard library'sconcurrent.futures.Executorinterface.It may be useful when you want to:smoothly migrate your synchronous codebase to asynchronous styledecrease a number of threads in your applicationReplace this:fromconcurrent.futuresimportThreadPoolExecutorwithThreadPoolExecutor()asex:future=ex.submit(sync_task)result=future.result()With this:fromaiofuturesimportAsyncExecutorwithAsyncExecutor()asex:future=ex.submit(async_task)result=future.result()The former spawns a lot of threads and experiences all cons of GIL, the latter
spawns the only one async thread (check outnotes)InstallationYou can installaiofuturesusing pip:pip install aiofuturesUsageImplicit initialization (global executor)Set an environment variableAIOFUTURES_INITto any value and use shortcuts from the library:os.environ.setdefault('AIOFUTURES_INIT','1')fromaiofuturesimportrun_asyncasyncdefio_bound_task(seconds):awaitasyncio.sleep(seconds)returnsecondsfuture=run_async(io_bound_task,5)print(future.result())AIOFUTURES_INITimplicitly initializes a globalAsyncExecutorand gives you an option to use
shortcutsrun_asyncandsync_to_async.Explicit initializationUse an instance of theAsyncExecutordirectly:fromaiofuturesimportAsyncExecutorexecutor=AsyncExecutor()future=executor.submit(io_bound_task,5)print(future.result())In cases when you need to do IO synchronously within async tasks, you can usesync_to_async:fromaiofuturesimportAsyncExecutor,sync_to_asyncexecutor=AsyncExecutor()asyncdefio_bound_task():# or with the shortcut# url = await sync_to_async(fetch_url_from_db_sync)url=awaitexecutor.sync_to_async(fetch_url_from_db_sync)data=awaitfetch_data(url)returndatafuture=executor.submit(io_bound_task)print(future.result())NOTE: You can use sync_to_async within tasks running in the executor only.UVLoopTo use with the high performanceuvloopinstall it before initialization:# install before the import for the global executorimportuvloopuvloop.install()fromaiofuturesimportrun_async...# or before an explicit initializationimportuvloopfromaiofuturesimportAsyncExecutoruvloop.install()executor=AsyncExecutor()NotesTake into account that asyncio still (CPython3.11)
resolves DNS in threads, not asynchronouslyAny blocking function will block the whole AsyncExecutorContributionAll suggestions are welcome! |
aioga | aiogainfo:Google Analytics client for asyncioInstallationpipinstallaiogaUsageimportasyncioimportuuidfromaiogaimportGATRACKING_ID='XX-XXXXXXXX-X'asyncdefgo():cid=uuid.uuid4()asyncwithGA(TRACKING_ID)asga:ga.event(str(cid),ec='tests',ea='success from context manager')# all methods returns asynio.Tasks, which can be awaited if neededloop=asyncio.get_event_loop()loop.run_until_complete(go())loop.close()DocumentationThe library is asynchronous client for measurement protocol.
All available hit types are supported.Full documentationof measurement protocol provides by googleAvailable methodspageviewscreenvieweventtransactionitemsocialexceptiontimingAvailable parametersAll methods require cid (Client ID). The value of this field
should be a random UUID (version 4) as described inhttp://www.ietf.org/rfc/rfc4122.txtLibrary support all available parametes for measurement protocol
(documentationhere) |
aiogapi | No description available on PyPI. |
aiogaro | AIOGaroAsynchronous library to access Garo ChargeboxesThis library is under developmentRequires Python >= 3.9, uses asyncio and aiohttpUsageInexample.py, you find the simplest usage of the library. You need two things to use the library:IP number of the ChargeboxSerial number of the ChargeboxYou find the IP number in two ways:accessing your router and determine which IP the Chargebox has been given from DHCPLog in tohttp://chargebox.webel.se/with serial number and password and see where you get redirected.Developed with the intention to be used with Home Assistant. |
aiogateway | No description available on PyPI. |
aiogbchat | Async Client-Server chat written in python.=================Quick start-------.. code::pip install aiogbchat --upgrade # installpython -m aiogbserver -- nogui # run server in console modepython -m aiogbclient # run client in GUI modeDocumentation:-------`<https://achicha.github.io/chat/>`_Known issues:-------* client disconnected with some logged issues (DB/asyncio). its not critical :)* windows: client doesn't work in console mode.* windows8 and higher: only works with pyqt5==5.9.2* testsHelpful:-------* How to generate docs:.. code::pip install sphinxsphinx-apidoc -f ../../chat -o /some_dir/docs/sourcemake html* How to deploy to pypi:.. code::pip install twinepython3 setup.py bdist_wheel # generate wheeltwine upload dist/*Links:-------* `Add sphinx pages to github <https://daler.github.io/sphinxdoc-test/includeme.html>`_ |
aiogc | aiogcAsync Google Calendar API Client for Python 3InstallationRun this in your terminal:pip install aiogcUsageFollowing code prints summary andstartandenddatetimes of upcoming events within nearest 5 days.importasyncioimportdatetimeimportaiohttpfromaiogcimportevents,modelsc=models.Credentials(client_id='<your_client_id>',client_secret='<your_client_secret>',scopes=['<your_scope1>','your_scope2'],refresh_token='<your_refresh_token>')asyncdefmain():asyncwithaiohttp.ClientSession()ass:es=awaitevents.list(calendar_id='<your_calendar_id>',credentials=c,session=s,singleEvents='true',timeMin=datetime.datetime.now().isoformat(),timeMax=(datetime.datetime.now()+datetime.timedelta(days=5)).isoformat(),orderBy='startTime',)foreines:print(f'{e.summary}:\n{e.start.dateTime}–{e.end.dateTime}')if__name__=='__main__':loop=asyncio.get_event_loop()loop.run_until_complete(main()) |
aiogcd | No description available on PyPI. |
aiogear | No description available on PyPI. |
aiogearman | RequirementsPython3.3+asyncioorPython3.4+LicenseTheaiogearmanis offered under MIT license. |
aiogemini | aiogeminiThis package provides implementations of a client and server speaking thegemini protocolbuilt on the python stdlib asyncio primitives.it is a work in progress.trypython -m aiogemini.serverorpython -m aiogemini.clientfor something
to look at. |
aiogen | Package Documentation |
aiogeoip | Real asynchronousgeolocation by IP address withAsyncio support.Get the geolocation of IPsasynchronouslyorsynchronouslyusing theIP-APIservice withcachedrequests for greater optimization of your software, providing back end withurllibandrequests.Docs+Pip+Multiplataform+CHANGELOGChangelog0.0.2 (02-10-2020)FeaturesIf a request is not successful (return code 200) it will be
tried again byNset by default to3in a time interval
in secondsNby default2.
You can still call thegeoipfunction only with a mandatory
IPv4 argument, so it will have the default behavior of trying 3 times.BugfixesAll backends deal with theconnection errorand return code429error.Improved DocumentationCreation of the page to document the synchronous functions.MiscBasic tests forgeoipfunction on all backends0.0.3 (14-10-2020)Bugfixes#2ModuleNotFoundError: No module named 'ujson'0.0.4 (17-10-2020)Features#3function that returns the external IP address, private IP and hostname.Misc#4Support to python3.4+Improved DocumentationFunctiongeoipin aio, requests and urllib background. Improved documentation for the Geolocation class. |
aio-geojson-client | python-aio-geojson-clientThis library provides convenient async access toGeoJSONFeeds.Installationpip install aio-geojson-clientKnown ImplementationsLibrarySourceTopicaio_geojson_generic_clientGeneric GeoJSON feedsAnyaio_geojson_geonetnz_quakesGeoNet New Zealand QuakesEarthquakesaio_geojson_geonetnz_volcanoGeoNet New Zealand VolcanoVolcanoesaio_geojson_nsw_rfs_incidentsNSW Rural Fire ServiceFiresaio_geojson_usgs_earthquakesU.S. Geological Survey Earthquake Hazards ProgramEarthquakesUsageEach implementation extracts relevant information from the GeoJSON feed. Not
all feeds contain the same level of information, or present their information
in different ways.After instantiating a particular class and supply the required parameters, you
can callupdateto retrieve the feed data. The return value will be a tuple
of a status code and the actual data in the form of a list of feed entries
specific to the selected feed.
Alternatively, calling methodupdate_overrideallows passing in ad-hoc filters
that override the globally defined filters.Status CodesOK: Update went fine and data was retrieved. The library may still
return empty data, for example because no entries fulfilled the filter
criteria.OK_NO_DATA: Update went fine but no data was retrieved, for example
because the server indicated that there was not update since the last request.ERROR: Something went wrong during the updateFeed ManagerThe Feed Manager helps managing feed updates over time, by notifying the
consumer of the feed about new feed entries, updates and removed entries
compared to the last feed update.If the current feed update is the first one, then all feed entries will be
reported as new. The feed manager will keep track of all feed entries'
external IDs that it has successfully processed.If the current feed update is not the first one, then the feed manager will
produce three sets:Feed entries that were not in the previous feed update but are in the
current feed update will be reported as new.Feed entries that were in the previous feed update and are still in the
current feed update will be reported as to be updated.Feed entries that were in the previous feed update but are not in the
current feed update will be reported to be removed.If the current update fails, then all feed entries processed in the previous
feed update will be reported to be removed.After a successful update from the feed, the feed manager provides two
different dates:last_updatewill be the timestamp of the last update from the feed
irrespective of whether it was successful or not.last_update_successfulwill be the timestamp of the last successful update
from the feed. This date may be useful if the consumer of this library wants
to treat intermittent errors from feed updates differently.last_timestamp(optional, depends on the feed data) will be the latest
timestamp extracted from the feed data.
This requires that the underlying feed data actually contains a suitable
date. This date may be useful if the consumer of this library wants to
process feed entries differently if they haven't actually been updated. |
aio-geojson-flightairmap | python-aio-geojson-flightairmapThis library provides convenient async access to localFlight Air Mapgeojson feed.This is an adaption of theNSW RFS Incidents feedby Malte Franken.Installationpip install aio-geojson-flightairmapUsageSee below for examples of how this library can be used. After instantiating a
particular class - feed or feed manager - and supply the required parameters,
you can callupdateto retrieve the feed data. The return value
will be a tuple of a status code and the actual data in the form of a list of
feed entries specific to the selected feed.Status CodesOK: Update went fine and data was retrieved. The library may still
return empty data, for example because no entries fulfilled the filter
criteria.OK_NO_DATA: Update went fine but no data was retrieved, for example
because the server indicated that there was not update since the last request.ERROR: Something went wrong during the updateParametersParameterDescriptionhome_coordinatesCoordinates (tuple of latitude/longitude)Supported FiltersFilterDescriptionRadiusfilter_radiusRadius in kilometers around the home coordinates in which events from feed are included.ExampleimportasynciofromaiohttpimportClientSessionfromaio_geojson_flightairmapimportFlightAirMapFeedasyncdefmain()->None:asyncwithClientSession()aswebsession:# Home Coordinates: Latitude: -33.0, Longitude: 150.0# Filter radius: 50 kmfeed=FlightAirMapFeed(websession,(-33.0,150.0),filter_radius=20000)status,entries=awaitfeed.update()print(status)print(entries)foreinentries:print(e.publication_date)print(e.coordinates)print(e.flight_num)asyncio.get_event_loop().run_until_complete(main())Feed entry propertiesEach feed entry is populated with the following properties:NameDescriptionFeed attributegeometryAll geometry details of this entry.geometrycoordinatesBest coordinates (latitude, longitude) of this entry.geometryexternal_idThe unique public identifier for this incident.guidtitleTitle of this entry.titleattributionAttribution of the feed.n/adistance_to_homeDistance in km of this entry to the home coordinates.n/apublication_dateThe publication date of the incidents.pubDateFeed ManagerThe Feed Manager helps managing feed updates over time, by notifying the
consumer of the feed about new feed entries, updates and removed entries
compared to the last feed update.If the current feed update is the first one, then all feed entries will be
reported as new. The feed manager will keep track of all feed entries'
external IDs that it has successfully processed.If the current feed update is not the first one, then the feed manager will
produce three sets:Feed entries that were not in the previous feed update but are in the
current feed update will be reported as new.Feed entries that were in the previous feed update and are still in the
current feed update will be reported as to be updated.Feed entries that were in the previous feed update but are not in the
current feed update will be reported to be removed.If the current update fails, then all feed entries processed in the previous
feed update will be reported to be removed.After a successful update from the feed, the feed manager provides two
different dates:last_updatewill be the timestamp of the last update from the feed
irrespective of whether it was successful or not.last_update_successfulwill be the timestamp of the last successful update
from the feed. This date may be useful if the consumer of this library wants
to treat intermittent errors from feed updates differently.last_timestamp(optional, depends on the feed data) will be the latest
timestamp extracted from the feed data.
This requires that the underlying feed data actually contains a suitable
date. This date may be useful if the consumer of this library wants to
process feed entries differently if they haven't actually been updated. |
aio-geojson-generic-client | python-aio-geojson-generic-clientThis library provides convenient async generic access toGeoJSONfeeds.Installationpip install aio-geojson-generic-clientUsageSee below for examples of how this library can be used. After instantiating a
particular class - feed or feed manager - and supply the required parameters,
you can callupdateto retrieve the feed data. The return value
will be a tuple of a status code and the actual data in the form of a list of
feed entries specific to the selected feed.Status CodesOK: Update went fine and data was retrieved. The library may still
return empty data, for example because no entries fulfilled the filter
criteria.OK_NO_DATA: Update went fine but no data was retrieved, for example
because the server indicated that there was not update since the last request.ERROR: Something went wrong during the updateParametersParameterDescriptionhome_coordinatesCoordinates (tuple of latitude/longitude)urlURL of the GeoJSON feedSupported FiltersFilterDescriptionRadiusfilter_radiusRadius in kilometers around the home coordinates in which events from feed are included.ExampleimportasynciofromaiohttpimportClientSessionfromaio_geojson_generic_clientimportGenericFeedasyncdefmain()->None:asyncwithClientSession()aswebsession:# Home Coordinates: Latitude: -33.0, Longitude: 150.0# Filter radius: 50 kmfeed=GenericFeed(websession,(-33.0,150.0),"https://www.rfs.nsw.gov.au/feeds/majorIncidents.json",filter_radius=50)status,entries=awaitfeed.update()print(status)print(entries)asyncio.get_event_loop().run_until_complete(main())Feed entry propertiesEach feed entry is populated with the following properties:NameDescriptionFeed attributegeometriesAll geometry details of this entry.geometrycoordinatesBest coordinates (latitude, longitude) of this entry.geometryexternal_idThe unique public identifier for this incident.id,guid,titleor hash of coordinatestitleTitle of this entry (if provided).titledistance_to_homeDistance in km of this entry to the home coordinates.n/apublication_dateThe publication date of the entry (if provided).pubDatepropertiesAll properties defined for this entry.propertiesFeed ManagerThe Feed Manager helps managing feed updates over time, by notifying the
consumer of the feed about new feed entries, updates and removed entries
compared to the last feed update.If the current feed update is the first one, then all feed entries will be
reported as new. The feed manager will keep track of all feed entries'
external IDs that it has successfully processed.If the current feed update is not the first one, then the feed manager will
produce three sets:Feed entries that were not in the previous feed update but are in the
current feed update will be reported as new.Feed entries that were in the previous feed update and are still in the
current feed update will be reported as to be updated.Feed entries that were in the previous feed update but are not in the
current feed update will be reported to be removed.If the current update fails, then all feed entries processed in the previous
feed update will be reported to be removed.After a successful update from the feed, the feed manager provides two
different dates:last_updatewill be the timestamp of the last update from the feed
irrespective of whether it was successful or not.last_update_successfulwill be the timestamp of the last successful update
from the feed. This date may be useful if the consumer of this library wants
to treat intermittent errors from feed updates differently.last_timestamp(optional, depends on the feed data) will be the latest
timestamp extracted from the feed data.
This requires that the underlying feed data actually contains a suitable
date. This date may be useful if the consumer of this library wants to
process feed entries differently if they haven't actually been updated. |
aio-geojson-geonetnz-quakes | python-aio-geojson-geonetnz-quakesThis library provides convenient async access to theGeoNet NZ Quakesfeed.Installationpip install aio-geojson-geonetnz-quakesUsageSee below for examples of how this library can be used. After instantiating a
particular class - feed or feed manager - and supply the required parameters,
you can callupdateto retrieve the feed data. The return value
will be a tuple of a status code and the actual data in the form of a list of
feed entries specific to the selected feed.Status CodesOK: Update went fine and data was retrieved. The library may still
return empty data, for example because no entries fulfilled the filter
criteria.OK_NO_DATA: Update went fine but no data was retrieved, for example
because the server indicated that there was not update since the last request.ERROR: Something went wrong during the updateParametersParameterDescriptionhome_coordinatesCoordinates (tuple of latitude/longitude)mmiRequest quakes that may have caused shaking greater than or equal to theMMIvalue in the New Zealand region. Allowable values are -1..8 inclusive. Default: -1 is used for quakes that are too small to calculate a stable MMI value for.Supported FiltersFilterDescriptionRadiusfilter_radiusRadius in kilometers around the home coordinates in which events from feed are included.Minimum Magnitudefilter_minimum_magnitudeMinimum magnitude as float value. Only events with a magnitude equal or above this value are included.Timefilter_timeTime interval; only events with a reported origin time that falls within now and this past time interval are included.ExampleimportasynciofromaiohttpimportClientSessionfromaio_geojson_geonetnz_quakesimportGeonetnzQuakesFeedasyncdefmain()->None:asyncwithClientSession()aswebsession:# Home Coordinates: Latitude: -41.2, Longitude: 174.7# MMI: 2# Filter radius: 200 km# Filter minimum magnitude: 2.5feed=GeonetnzQuakesFeed(websession,(-41.2,174.7),mmi=2,filter_radius=200,filter_minimum_magnitude=2.5)status,entries=awaitfeed.update()print(status)print(entries)asyncio.get_event_loop().run_until_complete(main())Feed entry propertiesEach feed entry is populated with the following properties:NameDescriptionFeed attributegeometryAll geometry details of this entry.geometrycoordinatesBest coordinates (latitude, longitude) of this entry.geometryexternal_idThe unique public identifier for this quake.publicIDtitleTitle of this entry.localityattributionAttribution of the feed.n/adistance_to_homeDistance in km of this entry to the home coordinates.n/atimeThe origin time of the quake.timedepthThe depth of the quake in km.depthmagnitudeThe summary magnitude for the quake.magnitudelocalityDistance and direction to the nearest locality.localitymmiThe calculated MMI shaking at the closest locality in the New Zealand region.mmiqualityThe quality of this information: best, good, caution, deleted.qualityFeed ManagerThe Feed Manager helps managing feed updates over time, by notifying the
consumer of the feed about new feed entries, updates and removed entries
compared to the last feed update.If the current feed update is the first one, then all feed entries will be
reported as new. The feed manager will keep track of all feed entries'
external IDs that it has successfully processed.If the current feed update is not the first one, then the feed manager will
produce three sets:Feed entries that were not in the previous feed update but are in the
current feed update will be reported as new.Feed entries that were in the previous feed update and are still in the
current feed update will be reported as to be updated.Feed entries that were in the previous feed update but are not in the
current feed update will be reported to be removed.If the current update fails, then all feed entries processed in the previous
feed update will be reported to be removed.After a successful update from the feed, the feed manager provides two
different dates:last_updatewill be the timestamp of the last update from the feed
irrespective of whether it was successful or not.last_update_successfulwill be the timestamp of the last successful update
from the feed. This date may be useful if the consumer of this library wants
to treat intermittent errors from feed updates differently.last_timestamp(optional, depends on the feed data) will be the latest
timestamp extracted from the feed data.
This requires that the underlying feed data actually contains a suitable
date. This date may be useful if the consumer of this library wants to
process feed entries differently if they haven't actually been updated. |
aio-geojson-geonetnz-volcano | python-aio-geojson-geonetnz-volcanoThis library for convenient async access toGeoNet NZ Volcanic Alert Levelfeed.Installationpip install aio-geojson-geonetnz-volcanoUsageSee below for examples of how this library can be used. After instantiating a
particular class - feed or feed manager - and supply the required parameters,
you can callupdateto retrieve the feed data. The return value
will be a tuple of a status code and the actual data in the form of a list of
feed entries specific to the selected feed.Status CodesOK: Update went fine and data was retrieved. The library may still
return empty data, for example because no entries fulfilled the filter
criteria.OK_NO_DATA: Update went fine but no data was retrieved, for example
because the server indicated that there was not update since the last request.ERROR: Something went wrong during the updateParametersParameterDescriptionhome_coordinatesCoordinates (tuple of latitude/longitude)Supported FiltersFilterDescriptionRadiusfilter_radiusRadius in kilometers around the home coordinates in which events from feed are included.ExampleimportasynciofromaiohttpimportClientSessionfromaio_geojson_geonetnz_volcanoimportGeonetnzVolcanoFeedasyncdefmain()->None:asyncwithClientSession()aswebsession:# Home Coordinates: Latitude: -41.2, Longitude: 174.7# Filter radius: 200 kmfeed=GeonetnzVolcanoFeed(websession,(-41.2,174.7),filter_radius=200)status,entries=awaitfeed.update()print(status)print(entries)asyncio.get_event_loop().run_until_complete(main())Feed entry propertiesEach feed entry is populated with the following properties:NameDescriptionFeed attributegeometryAll geometry details of this entry.geometrycoordinatesBest coordinates (latitude, longitude) of this entry.geometryexternal_idThe unique public identifier for this volcano.volcanoIDtitleVolcano title.volcanoTitleattributionAttribution of the feed.n/adistance_to_homeDistance in km of this entry to the home coordinates.n/aalert_levelVolcanic alert level (0-5).levelactivityVolcanic activity.activityhazardsMost likely hazards.hazardsFeed ManagerThe Feed Manager helps managing feed updates over time, by notifying the
consumer of the feed about new feed entries, updates and removed entries
compared to the last feed update.If the current feed update is the first one, then all feed entries will be
reported as new. The feed manager will keep track of all feed entries'
external IDs that it has successfully processed.If the current feed update is not the first one, then the feed manager will
produce three sets:Feed entries that were not in the previous feed update but are in the
current feed update will be reported as new.Feed entries that were in the previous feed update and are still in the
current feed update will be reported as to be updated.Feed entries that were in the previous feed update but are not in the
current feed update will be reported to be removed.If the current update fails, then all feed entries processed in the previous
feed update will be reported to be removed.After a successful update from the feed, the feed manager provides two
different dates:last_updatewill be the timestamp of the last update from the feed
irrespective of whether it was successful or not.last_update_successfulwill be the timestamp of the last successful update
from the feed. This date may be useful if the consumer of this library wants
to treat intermittent errors from feed updates differently.last_timestampis not available for this feed. |
aio-geojson-nsw-rfs-incidents | python-aio-geojson-nsw-rfs-incidentsThis library provides convenient async access to theNSW Rural Fire Serviceincidents feed.Installationpip install aio-geojson-nsw-rfs-incidentsUsageSee below for examples of how this library can be used. After instantiating a
particular class - feed or feed manager - and supply the required parameters,
you can callupdateto retrieve the feed data. The return value
will be a tuple of a status code and the actual data in the form of a list of
feed entries specific to the selected feed.Status CodesOK: Update went fine and data was retrieved. The library may still
return empty data, for example because no entries fulfilled the filter
criteria.OK_NO_DATA: Update went fine but no data was retrieved, for example
because the server indicated that there was not update since the last request.ERROR: Something went wrong during the updateParametersParameterDescriptionhome_coordinatesCoordinates (tuple of latitude/longitude)Supported FiltersFilterDescriptionRadiusfilter_radiusRadius in kilometers around the home coordinates in which events from feed are included.Categoriesfilter_categoriesArray of category names. Only events with a category matching any of these is included.ExampleimportasynciofromaiohttpimportClientSessionfromaio_geojson_nsw_rfs_incidentsimportNswRuralFireServiceIncidentsFeedasyncdefmain()->None:asyncwithClientSession()aswebsession:# Home Coordinates: Latitude: -33.0, Longitude: 150.0# Filter radius: 50 km# Filter categories: 'Advice'feed=NswRuralFireServiceIncidentsFeed(websession,(-33.0,150.0),filter_radius=50,filter_categories=['Advice'])status,entries=awaitfeed.update()print(status)print(entries)asyncio.get_event_loop().run_until_complete(main())Feed entry propertiesEach feed entry is populated with the following properties:NameDescriptionFeed attributegeometryAll geometry details of this entry.geometrycoordinatesBest coordinates (latitude, longitude) of this entry.geometryexternal_idThe unique public identifier for this incident.guidtitleTitle of this entry.titleattributionAttribution of the feed.n/adistance_to_homeDistance in km of this entry to the home coordinates.n/acategoryThe alert level of the incident ('Emergency Warning', 'Watch and Act', 'Advice','Not Applicable').categorypublication_dateThe publication date of the incidents.pubDatedescriptionThe description of the incident.descriptionlocationLocation description of the incident.description->LOCATIONcouncil_areaCouncil are this incident falls into.description->COUNCIL AREAstatusStatus of the incident.description->STATUStypeType of the incident (e.g. Bush Fire, Grass Fire, Hazard Reduction).description->TYPEfireIndicated if this incident is a fire or not (True/False).description->FIREsizeSize in ha.description->SIZEresponsible_agencyAgency responsible for this incident.description->RESPONSIBLE AGENCYFeed ManagerThe Feed Manager helps managing feed updates over time, by notifying the
consumer of the feed about new feed entries, updates and removed entries
compared to the last feed update.If the current feed update is the first one, then all feed entries will be
reported as new. The feed manager will keep track of all feed entries'
external IDs that it has successfully processed.If the current feed update is not the first one, then the feed manager will
produce three sets:Feed entries that were not in the previous feed update but are in the
current feed update will be reported as new.Feed entries that were in the previous feed update and are still in the
current feed update will be reported as to be updated.Feed entries that were in the previous feed update but are not in the
current feed update will be reported to be removed.If the current update fails, then all feed entries processed in the previous
feed update will be reported to be removed.After a successful update from the feed, the feed manager provides two
different dates:last_updatewill be the timestamp of the last update from the feed
irrespective of whether it was successful or not.last_update_successfulwill be the timestamp of the last successful update
from the feed. This date may be useful if the consumer of this library wants
to treat intermittent errors from feed updates differently.last_timestamp(optional, depends on the feed data) will be the latest
timestamp extracted from the feed data.
This requires that the underlying feed data actually contains a suitable
date. This date may be useful if the consumer of this library wants to
process feed entries differently if they haven't actually been updated. |
aio-geojson-nsw-transport-incidents | python-aio-geojson-nsw-transport-incidentsThis library provides convenient async access to theNSW Transport Service Live traffic statusincidents feed.
The feed can be seen online on (https://www.livetraffic.com/)Installationpip install aio-geojson-nsw-transport-incidentsUsageSee below for examples of how this library can be used. After instantiating a
particular class - feed or feed manager - and supply the required parameters,
you can callupdateto retrieve the feed data. The return value
will be a tuple of a status code and the actual data in the form of a list of
feed entries specific to the selected feed.Status CodesOK: Update went fine and data was retrieved. The library may still
return empty data, for example because no entries fulfilled the filter
criteria.OK_NO_DATA: Update went fine but no data was retrieved, for example
because the server indicated that there was not update since the last request.ERROR: Something went wrong during the updateParametersParameterDescriptionhome_coordinatesCoordinates (tuple of latitude/longitude)featureType of Hazard to retreiveTraffic Hazards are divided into six basic types:Incidents (incident-openincident-closedincident)Fire (fire-openfire-closedfire)Flood (flood-openflood-closedflood)Alpine conditions (alpine-openalpine-closedalpine)Major Events (majorevent-openmajorevent-closedmajorevent)Roadworks (roadwork-openroadwork-closedroadwork)Hazards can be open, closed (or both can be retreived). Refer to theLive Traffic Data Developer GuideSupported FiltersFilterDescriptionRadiusfilter_radiusRadius in kilometers around the home coordinates in which events from feed are included.Categoriesfilter_categoriesArray of category names. Only events with a category matching any of these is included.ExampleimportasynciofromaiohttpimportClientSessionfromaio_geojson_nsw_transport_incidentsimportNswTransportServiceIncidentsFeedasyncdefmain()->None:asyncwithClientSession()aswebsession:# Home Coordinates: Latitude: -33.0, Longitude: 150.0# Filter radius: 50 km# Filter categories: 'Scheduled roadwork'# Hazard type : 'roadworks-open'feed=NswTransportServiceIncidentsFeed(websession,(-33.0,150.0),filter_radius=50,filter_categories=['Scheduled roadwork'],hazard="roadwork-open")status,entries=awaitfeed.update()print(status)print(entries)asyncio.get_event_loop().run_until_complete(main())Feed entry propertiesEach feed entry is populated with the following properties:NameDescriptionFeed attributegeometryAll geometry details of this entry.geometrycoordinatesBest coordinates (latitude, longitude) of this entry.geometryexternal_idThe unique public identifier for this incident.guidtitleTitle of this entry.titleattributionAttribution of the feed.n/adistance_to_homeDistance in km of this entry to the home coordinates.n/acategoryThe broad hazard category description assigned to the hazard by TMC Communications. Used internally by TMCCommunications for reporting hazard statistics.Please note the values used by this property are subject to change and should not be relied upon.mainCategorypublication_dateThe publication date of the incidents.createddescriptionThe description of the incident.headlinecouncil_areaCouncil are this incident falls into.roads->suburbroadCouncil are this incident falls into.roads->mainStreettypeType of the incident (e.g. Bush Fire, Grass Fire, Hazard Reduction).typepublicTransportThe publication date of this entrypublicTransportadviceAThe first advice of this entry. The first standard piece of advice to motorists. At the present timeadviceAadviceBTurn the second advice of this entryadviceBadviceOtherThe other advice of this entryadviceOtherisMajorTrue is the incident is major for this entryisMajorisEndedTrue if the hazard has ended, otherwise false. Once ended, the hazard’s record in our internal tracking system is closed and further modification becomes impossible unless the record is later re-opened. This property is a counterpart to the createdproperty. When true, the lastUpdatedproperty of the hazard will be the date/time when the hazard’s record in the tracking system was closed.isEndedisNewTrue if the incident is new for this entry.isNewisImpactNetworkTrue if the hazard is currently having some impact on traffic on the road network.isImpactNetworkdiversionsThe Summary of any traffic diversions in place. The text may contain HTML markup..diversionssubCategoryThe sub-category of incident of this entry.subCategorydurationThe Planned duration of the hazard. This property is rarely used.durationFeed ManagerThe Feed Manager helps managing feed updates over time, by notifying the
consumer of the feed about new feed entries, updates and removed entries
compared to the last feed update.If the current feed update is the first one, then all feed entries will be
reported as new. The feed manager will keep track of all feed entries'
external IDs that it has successfully processed.If the current feed update is not the first one, then the feed manager will
produce three sets:Feed entries that were not in the previous feed update but are in the
current feed update will be reported as new.Feed entries that were in the previous feed update and are still in the
current feed update will be reported as to be updated.Feed entries that were in the previous feed update but are not in the
current feed update will be reported to be removed.If the current update fails, then all feed entries processed in the previous
feed update will be reported to be removed.After a successful update from the feed, the feed manager provides two
different dates:last_updatewill be the timestamp of the last update from the feed
irrespective of whether it was successful or not.last_update_successfulwill be the timestamp of the last successful update
from the feed. This date may be useful if the consumer of this library wants
to treat intermittent errors from feed updates differently.last_timestamp(optional, depends on the feed data) will be the latest
timestamp extracted from the feed data.
This requires that the underlying feed data actually contains a suitable
date. This date may be useful if the consumer of this library wants to
process feed entries differently if they haven't actually been updated.Attribution and motivationThis is a fork ofexxamalte/python-aio-geojson-nsw-rfs-incidents.
It deferes mainly as the geoJSON feeds generated by NSW Transport using QGis. QGis generates files that don't match exactly geojson format (geometry types :POINTinstead ofPoint)This library has been created forHome Assistant component. |
aio-geojson-planefinderlocal | python-aio-geojson-planefinder-localThis library provides convenient async access to local Planefinder json feed and converts it to a geojson feed.This is an adaption of theNSW RFS Incidents feedby Malte Franken.Installationpip install aio-geojson-planefinder-localUsageSee below for examples of how this library can be used. After instantiating a
particular class - feed or feed manager - and supply the required parameters,
you can callupdateto retrieve the feed data. The return value
will be a tuple of a status code and the actual data in the form of a list of
feed entries specific to the selected feed.Status CodesOK: Update went fine and data was retrieved. The library may still
return empty data, for example because no entries fulfilled the filter
criteria.OK_NO_DATA: Update went fine but no data was retrieved, for example
because the server indicated that there was not update since the last request.ERROR: Something went wrong during the updateParametersParameterDescriptionhome_coordinatesCoordinates (tuple of latitude/longitude)Supported FiltersFilterDescriptionRadiusfilter_radiusRadius in kilometers around the home coordinates in which events from feed are included.ExampleimportasynciofromaiohttpimportClientSessionfromaio_geojson_planefinderlocalimportplanefinderlocalFeedasyncdefmain()->None:asyncwithClientSession()aswebsession:# Home Coordinates: Latitude: -33.0, Longitude: 150.0# Filter radius: 50 kmfeed=PlanefinderLocalFeed(websession,(-33.0,150.0),filter_radius=20000)status,entries=awaitfeed.update()print(status)print(entries)foreinentries:print(e.publication_date)print(e.coordinates)print(e.flight_num)asyncio.get_event_loop().run_until_complete(main())Feed entry propertiesEach feed entry is populated with the following properties:NameDescriptionFeed attributegeometryAll geometry details of this entry.geometrycoordinatesBest coordinates (latitude, longitude) of this entry.geometryexternal_idThe unique public identifier for this incident.guidtitleTitle of this entry.titleattributionAttribution of the feed.n/adistance_to_homeDistance in km of this entry to the home coordinates.n/apublication_dateThe publication date of the incidents.pubDateFeed ManagerThe Feed Manager helps managing feed updates over time, by notifying the
consumer of the feed about new feed entries, updates and removed entries
compared to the last feed update.If the current feed update is the first one, then all feed entries will be
reported as new. The feed manager will keep track of all feed entries'
external IDs that it has successfully processed.If the current feed update is not the first one, then the feed manager will
produce three sets:Feed entries that were not in the previous feed update but are in the
current feed update will be reported as new.Feed entries that were in the previous feed update and are still in the
current feed update will be reported as to be updated.Feed entries that were in the previous feed update but are not in the
current feed update will be reported to be removed.If the current update fails, then all feed entries processed in the previous
feed update will be reported to be removed.After a successful update from the feed, the feed manager provides two
different dates:last_updatewill be the timestamp of the last update from the feed
irrespective of whether it was successful or not.last_update_successfulwill be the timestamp of the last successful update
from the feed. This date may be useful if the consumer of this library wants
to treat intermittent errors from feed updates differently.last_timestamp(optional, depends on the feed data) will be the latest
timestamp extracted from the feed data.
This requires that the underlying feed data actually contains a suitable
date. This date may be useful if the consumer of this library wants to
process feed entries differently if they haven't actually been updated. |
aio-geojson-query | python-aio-geojson-queryThis library is my attempt at creating a generalized client for theaio-geojson-clientlibrary.Of course, this requires some uncomfortable contorting as the properties in a GeoJson feed are free-form (seerfc7946)This is currently under development, so apologies for the bugs.Installationpip install aio-geojson-queryUsageSee below for examples of how this library can be used. After instantiating a
particular class - feed or feed manager - and supplying the required parameters,
you can callupdateto retrieve the feed data. The return value
will be a tuple of a status code and the actual data in the form of a list of
feed entries specific to the selected feed.Status CodesOK: Update went fine and data was retrieved. The library may still
return empty data, for example because no entries fulfilled the filter
criteria.OK_NO_DATA: Update went fine but no data was retrieved, for example
because the server indicated that there was not update since the last request.ERROR: Something went wrong during the updateParametersParameterDescriptionhome_coordinatesCoordinates (tuple of latitude/longitude)Supported FiltersFilterDescriptionRadiusfilter_radiusRadius in kilometers around the home coordinates in which events from feed are included.Criteriafilter_criteriaArray of filtering conditions.Criteria SyntaxAt this time, criteria are pretty simple and are applied using anoroperator. Therefore, properties matching any function will be a match.Available operators are:==,!=,<,>.The latter two will always compare the property as a float value.MappingsSince this library has no knowledge of the feeds being retrieved, this is used to map property names. Mappings are passed as an additional argument called, of course,mappingsMapping NamesBy default, mappings are as simple as: the first argument is known, in the feed, as the second argument.For instance, let's say you are looking for thedatemapping and, in the feed, that field is calledpublished_date-- you will want to help the library find it by passing this mapping:"date": "published_date"Parametric MappingSometimes, a value can only be extracted from a complex property. For instance,locationmay only be available inside thedescriptionproperty. These mappings are denoted using~~followed by the regular expression that will extract the value:"location": "description~~LOCATION: (?P<{}>[^<]+) <br"Mandatory and default mappingsSome properties are mandatory. For instance, if the library does not find thedateproperty, it will not be able to synchronize the feed properly.If you do not specify mappings for these variables, the library may attempt to guess what their names could be.For instance:PropertyGuessed NamesidEach entry's unique identifierid,guid(@see FeedManager)dateMandatorytime,datedateformatA pseudo mappingHelps the library parse the date property.descriptiondescription,detailsDate ParsingThedateformatpseudo mapping can be:FormatMeaningsecondsThis is an epoch timestamp,millisecondsA timestamp in milliseconds.isoISO-3601 or RFC-3339 compatible format. Allows variations.An arbitrary stringUsed by the library in thestrptimefunction.ExampleI recommend checking outpython-aio-geojson-nsw-rfs-incidentswhich is a library dedicated to retrieving fire incidents information, written by the same author as the library I am creating this middleware for. You may be interested in comparing that library's example code to the one below, which does the same thing (then checks for earthquakes when done):importasynciofromaiohttpimportClientSessionfromaio_geojson_queryimportGeoJsonQueryFeedasyncdefmain()->None:asyncwithClientSession()aswebsession:# NSW Incidents Feed# Home Coordinates: Latitude: -33.0, Longitude: 150.0# Filter radius: 50 km# Filter categories: 'Advice'feed=GeoJsonQueryFeed(websession,"https://www.rfs.nsw.gov.au/feeds/majorIncidents.json",(-33.0,150.0),filter_radius=500,filter_criteria=[['category','==','Advice']],mappings={"dateformat":"iso","date":"pubDate","location":"description~~LOCATION: (?P<{}>[^<]+) <br"})status,entries=awaitfeed.update()print(status)forentryinentries:print("%s[%s]: @%s"%(entry.title,entry.publication_date,entry.location))# Earthquakes, magnitude at least 3, around Los Angelesfeed2=GeoJsonQueryFeed(websession,"https://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/all_month.geojson",(34.052235,-118.243683),filter_criteria=[['mag','>','3.0']],filter_radius=50,mappings={"dateformat":"milliseconds","date":"updated"})status,entries=awaitfeed2.update()print(status)forentryinentries:print("%s[%s]: @%s"%(entry.title,entry.publication_date,entry.title))asyncio.get_event_loop().run_until_complete(main())Feed ManagerThe Feed Manager helps managing feed updates over time, by notifying the
consumer of the feed about new feed entries, updates and removed entries
compared to the last feed update.If the current feed update is the first one, then all feed entries will be
reported as new. The feed manager will keep track of all feed entries'
external IDs that it has successfully processed.If the current feed update is not the first one, then the feed manager will
produce three sets:Feed entries that were not in the previous feed update but are in the
current feed update will be reported as new.Feed entries that were in the previous feed update and are still in the
current feed update will be reported as to be updated.Feed entries that were in the previous feed update but are not in the
current feed update will be reported to be removed.If the current update fails, then all feed entries processed in the previous
feed update will be reported to be removed.After a successful update from the feed, the feed manager provides two
different dates:last_updatewill be the timestamp of the last update from the feed
irrespective of whether it was successful or not.last_update_successfulwill be the timestamp of the last successful update
from the feed. This date may be useful if the consumer of this library wants
to treat intermittent errors from feed updates differently.last_timestamp(optional, depends on the feed data) will be the latest
timestamp extracted from the feed data.
This requires that the underlying feed data actually contains a suitable
date. This date may be useful if the consumer of this library wants to
process feed entries differently if they haven't actually been updated.SpecifyidWhen in doubt... make sure you specify a mapping forid-- if only one entry is returned by the feed manager when you expect multiple entries, it is likely that the feed entries are not properly identified. If necessary, specify a mapping foridto a property that is unique to each entry. For instance, in the USGS earthquake feed, such an entry iscode. |
aio-geojson-tas-tfs-incidents | python-aio-geojson-tas-tfs-incidentsThis library is a fork ofpython-aio-geojson-nsw-rfs-incidentsfor convenient async access to theTas Alert Feed.Installationpip install aio-geojson-tas-tfs-incidentsUsageSee below for examples of how this library can be used. After instantiating a
particular class - feed or feed manager - and supply the required parameters,
you can callupdateto retrieve the feed data. The return value
will be a tuple of a status code and the actual data in the form of a list of
feed entries specific to the selected feed.Status CodesOK: Update went fine and data was retrieved. The library may still
return empty data, for example because no entries fulfilled the filter
criteria.OK_NO_DATA: Update went fine but no data was retrieved, for example
because the server indicated that there was not update since the last request.ERROR: Something went wrong during the updateParametersParameterDescriptionhome_coordinatesCoordinates (tuple of latitude/longitude)Supported FiltersFilterDescriptionRadiusfilter_radiusRadius in kilometers around the home coordinates in which events from feed are included.Categoriesfilter_categoriesArray of category names. Only events with a category matching any of these is included.ExampleimportasynciofromaiohttpimportClientSessionfromaio_geojson_tas_tfs_incidentsimportTasFireServiceIncidentsFeedasyncdefmain()->None:asyncwithClientSession()aswebsession:# Home Coordinates: Latitude: -42.0, Longitude: 147.0# Filter radius: 50 km# Filter categories: 'Advice'feed=TasFireServiceIncidentsFeed(websession,(-42,147.0),filter_radius=50,filter_feedtypes=['warning'],filter_alertlevels=['watch_and_act','advice'])status,entries=awaitfeed.update()print(status)print(entries)asyncio.get_event_loop().run_until_complete(main())Feed entry propertiesEach feed entry is populated with the following properties:NameDescriptionFeed attributegeometriesAll geometry details of this entry.geometriescoordinatesBest coordinates (latitude, longitude) of this entry.geometriesexternal_idThe unique public identifier for this incident.idtitleTitle of this entry.titleattributionAttribution of the feed.n/adistance_to_homeDistance in km of this entry to the home coordinates.n/afeedTypeThe type of messages ('incident', 'warning').feedTypealertLevelThe alert level of the incident ("emergency_warning", "watch_and_act", "advice", "not_applicable"). Only available for feedType 'warning'.categorycreatedThe creation date of the incident.createdchangedThe last changed date of the incident.changedbodyHtmlThe description of the incident including HTML tags.bodyHtmldescriptionThe description of the incident without HTML tags.n/alocationLocation description of the incident.locationstatusStatus of the incident.statustypeType of the incident (e.g. Bush Fire, Grass Fire, Hazard Reduction).type['name']burntAreaBurnt area in ha.burntAreaFeed ManagerThe Feed Manager helps managing feed updates over time, by notifying the
consumer of the feed about new feed entries, updates and removed entries
compared to the last feed update.If the current feed update is the first one, then all feed entries will be
reported as new. The feed manager will keep track of all feed entries'
external IDs that it has successfully processed.If the current feed update is not the first one, then the feed manager will
produce three sets:Feed entries that were not in the previous feed update but are in the
current feed update will be reported as new.Feed entries that were in the previous feed update and are still in the
current feed update will be reported as to be updated.Feed entries that were in the previous feed update but are not in the
current feed update will be reported to be removed.If the current update fails, then all feed entries processed in the previous
feed update will be reported to be removed.After a successful update from the feed, the feed manager provides two
different dates:last_updatewill be the timestamp of the last update from the feed
irrespective of whether it was successful or not.last_update_successfulwill be the timestamp of the last successful update
from the feed. This date may be useful if the consumer of this library wants
to treat intermittent errors from feed updates differently.last_timestamp(optional, depends on the feed data) will be the latest
timestamp extracted from the feed data.
This requires that the underlying feed data actually contains a suitable
date. This date may be useful if the consumer of this library wants to
process feed entries differently if they haven't actually been updated. |
aio-geojson-usgs-earthquakes | python-aio-geojson-usgs-earthquakesThis library provides convenient async access to U.S. Geological Survey Earthquake Hazards Program feeds.Installationpip install aio-geojson-usgs-earthquakesUsageSee below for examples of how this library can be used. After instantiating a
particular class - feed or feed manager - and supply the required parameters,
you can callupdateto retrieve the feed data. The return value
will be a tuple of a status code and the actual data in the form of a list of
feed entries specific to the selected feed.Status CodesOK: Update went fine and data was retrieved. The library may still
return empty data, for example because no entries fulfilled the filter
criteria.OK_NO_DATA: Update went fine but no data was retrieved, for example
because the server indicated that there was not update since the last request.ERROR: Something went wrong during the updateParametersParameterDescriptionhome_coordinatesCoordinates (tuple of latitude/longitude)Supported FeedsCategoryFeedPast Hour - Significant Earthquakespast_hour_significant_earthquakesPast Hour - M4.5+ Earthquakespast_hour_m45_earthquakesPast Hour - M2.5+ Earthquakespast_hour_m25_earthquakesPast Hour - M1.0+ Earthquakespast_hour_m10_earthquakesPast Hour - All Earthquakespast_hour_all_earthquakesPast Day - Significant Earthquakespast_day_significant_earthquakesPast Day - M4.5+ Earthquakespast_day_m45_earthquakesPast Day - M2.5+ Earthquakespast_day_m25_earthquakesPast Day - M1.0+ Earthquakespast_day_m10_earthquakesPast Day - All Earthquakespast_day_all_earthquakesPast 7 Days - Significant Earthquakespast_week_significant_earthquakesPast 7 Days - M4.5+ Earthquakespast_week_m45_earthquakesPast 7 Days - M2.5+ Earthquakespast_week_m25_earthquakesPast 7 Days - M1.0+ Earthquakespast_week_m10_earthquakesPast 7 Days - All Earthquakespast_week_all_earthquakesPast 30 Days - Significant Earthquakespast_month_significant_earthquakesPast 30 Days - M4.5+ Earthquakespast_month_m45_earthquakesPast 30 Days - M2.5+ Earthquakespast_month_m25_earthquakesPast 30 Days - M1.0+ Earthquakespast_month_m10_earthquakesPast 30 Days - All Earthquakespast_month_all_earthquakesSupported FiltersFilterDescriptionRadiusfilter_radiusRadius in kilometers around the home coordinates in which events from feed are included.Minimum Magnitudefilter_minimum_magnitudeMinimum magnitude as float value. Only event with a magnitude equal or above this value are included.ExampleimportasynciofromaiohttpimportClientSessionfromaio_geojson_usgs_earthquakesimportUsgsEarthquakeHazardsProgramFeedasyncdefmain()->None:asyncwithClientSession()aswebsession:# Home Coordinates: Latitude: 21.3, Longitude: -157.8# Feed: Past Day - All Earthquakes# Filter radius: 500 km# Filter minimum magnitude: 4.0feed=UsgsEarthquakeHazardsProgramFeed(websession,(21.3,-157.8),'past_day_all_earthquakes',filter_radius=5000,filter_minimum_magnitude=4.0)status,entries=awaitfeed.update()print(status)print(entries)asyncio.get_event_loop().run_until_complete(main())Feed entry propertiesEach feed entry is populated with the following properties:NameDescriptionFeed attributegeometriesAll geometry details of this entry.geometrycoordinatesBest coordinates (latitude, longitude) of this entry.geometrydistance_to_homeDistance in km of this entry to the home coordinates.n/aattributionAttribution of the feed.n/aexternal_idThe unique public identifier for this entry.idtitleTitle of this entry.titleplaceDescription of the place where this earthquakes occurred.placemagnitudeMagnitude of this earthquake.magtimeDate and time when this event occurred.timeupdatedDate and time when this entry was last updated.updatedalertAlert level of this entry ("green", "yellow", "orange", "red").alerttypeType of this seismic event ("earthquake", "quarry").typestatusIndicates whether the event has been reviewed by a human ("automatic", "reviewed", "deleted").statusFeed ManagerThe Feed Manager helps managing feed updates over time, by notifying the
consumer of the feed about new feed entries, updates and removed entries
compared to the last feed update.If the current feed update is the first one, then all feed entries will be
reported as new. The feed manager will keep track of all feed entries'
external IDs that it has successfully processed.If the current feed update is not the first one, then the feed manager will
produce three sets:Feed entries that were not in the previous feed update but are in the
current feed update will be reported as new.Feed entries that were in the previous feed update and are still in the
current feed update will be reported as to be updated.Feed entries that were in the previous feed update but are not in the
current feed update will be reported to be removed.If the current update fails, then all feed entries processed in the previous
feed update will be reported to be removed.After a successful update from the feed, the feed manager provides two
different dates:last_updatewill be the timestamp of the last update from the feed
irrespective of whether it was successful or not.last_update_successfulwill be the timestamp of the last successful update
from the feed. This date may be useful if the consumer of this library wants
to treat intermittent errors from feed updates differently.last_timestamp(optional, depends on the feed data) will be the latest
timestamp extracted from the feed data.
This requires that the underlying feed data actually contains a suitable
date. This date may be useful if the consumer of this library wants to
process feed entries differently if they haven't actually been updated. |
aio-geojson-vicemergency-incidents | python-aio-geojson-vicemergency-incidentsThis library provides convenient async access to theVIC Emergency Websiteincidents feed.This code is based on [https://github.com/exxamalte/python-aio-geojson-nsw-rfs-incidents] by exxamalte.Installationpip install aio-geojson-vicemergency-incidentsUsageSee below for examples of how this library can be used. After instantiating a
particular class - feed or feed manager - and supply the required parameters,
you can callupdateto retrieve the feed data. The return value
will be a tuple of a status code and the actual data in the form of a list of
feed entries specific to the selected feed.Status CodesOK: Update went fine and data was retrieved. The library may still return empty data, for example because no entries fulfilled the filter criteria.OK_NO_DATA: Update went fine but no data was retrieved, for example because the server indicated that there was not update since the last request.ERROR: Something went wrong during the updateParametersParameterDescriptionhome_coordinatesCoordinates (tuple of latitude/longitude)Supported FiltersFilterDescriptionRadiusfilter_radiusRadius in kilometers around the home coordinates in which events from feed are included.Include Categoriesfilter_inc_categoriesArray of category names. Only include events with a category matching any of these is included.Exclude Categoriesfilter_exc_categoriesArray of category names. Exclude events with a category matching any of these is included. One example is previous burn areas from burning off, which have the category 'Burn Area' which last long after the event.Statewidefilter_statewideTrue or False. If set to true, will ignore statewide events (such as the COVID-19 pandemic advice) which doesn't change often and may not be necessary to include.ExampleimportasynciofromaiohttpimportClientSessionfromaio_geojson_vicemergency_incidentsimportVicEmergencyIncidentsFeedasyncdefmain()->None:asyncwithClientSession()aswebsession:# Home Coordinates: Latitude: -37.813629, Longitude: 144.963058 (Elizabeth St in the CBD)# Filter radius: 50 km# Filter include categories: ''# Filter exclude categories: 'Burn Advice'# Filter statewide incidents: Falsefeed=VICEmergencyIncidentsFeed(websession,(-37.813629,144.963058),filter_radius=50,filter_inc_categories=[''],filter_exc_categories=['Burn Advice'],filter_statewide=False)status,entries=awaitfeed.update()print(status)print(entries)asyncio.get_event_loop().run_until_complete(main())Feed entry propertiesEach feed entry is populated with the following properties:NameDescriptionFeed attributegeometryAll geometry details of this entry.geometrycoordinatesBest coordinates (latitude, longitude) of this entry.geometryexternal_idThe unique public identifier for this incident.guidtitleTitle of this entry.titleattributionAttribution of the feed.n/adistance_to_homeDistance in km of this entry to the home coordinates.n/aFeed ManagerThe Feed Manager helps managing feed updates over time, by notifying the consumer of the feed about new feed entries, updates and removed entries compared to the last feed update.If the current feed update is the first one, then all feed entries will be reported as new. The feed manager will keep track of all feed entries' external IDs that it has successfully processed.If the current feed update is not the first one, then the feed manager will produce three sets:Feed entries that were not in the previous feed update but are in the current feed update will be reported as new.Feed entries that were in the previous feed update and are still in the current feed update will be reported as to be updated.Feed entries that were in the previous feed update but are not in the current feed update will be reported to be removed.If the current update fails, then all feed entries processed in the previous feed update will be reported to be removed.After a successful update from the feed, the feed manager provides two
different dates:last_updatewill be the timestamp of the last update from the feed irrespective of whether it was successful or not.last_update_successfulwill be the timestamp of the last successful update from the feed. This date may be useful if the consumer of this library wants to treat intermittent errors from feed updates differently.last_timestamp(optional, depends on the feed data) will be the latest timestamp extracted from the feed data. This requires that the underlying feed data actually contains a suitable date. This date may be useful if the consumer of this library wants to process feed entries differently if they haven't actually been updated. |
aio-georss-client | python-aio-georss-clientThis library provides convenient async access toGeoRSSFeeds.Installationpip install aio-georss-clientKnown ImplementationsLibrarySourceTopicaio_georss_gdacsGlobal Disaster Alert and Coordination System (GDACS)Natural DisastersUsageEach implementation extracts relevant information from the GeoJSON feed. Not
all feeds contain the same level of information, or present their information
in different ways.After instantiating a particular class and supply the required parameters, you
can callupdateto retrieve the feed data. The return value will be a tuple
of a status code and the actual data in the form of a list of feed entries
specific to the selected feed.Status CodesOK: Update went fine and data was retrieved. The library may still
return empty data, for example because no entries fulfilled the filter
criteria.OK_NO_DATA: Update went fine but no data was retrieved, for example
because the server indicated that there was not update since the last request.ERROR: Something went wrong during the updateGeometry FeaturesThis library supports 3 different types of geometries:PointPolygonBounding BoxBy default each feed entry is using all available geometries from the external
feed. If required however, you can exclude geometries by overriding
FeedEntry#features and only return the geometries you want to support in your
specific implementation.Feed ManagerThe Feed Manager helps managing feed updates over time, by notifying the
consumer of the feed about new feed entries, updates and removed entries
compared to the last feed update.If the current feed update is the first one, then all feed entries will be
reported as new. The feed manager will keep track of all feed entries'
external IDs that it has successfully processed.If the current feed update is not the first one, then the feed manager will
produce three sets:Feed entries that were not in the previous feed update but are in the
current feed update will be reported as new.Feed entries that were in the previous feed update and are still in the
current feed update will be reported as to be updated.Feed entries that were in the previous feed update but are not in the
current feed update will be reported to be removed.If the current update fails, then all feed entries processed in the previous
feed update will be reported to be removed.After a successful update from the feed, the feed manager provides two
different dates:last_updatewill be the timestamp of the last update from the feed
irrespective of whether it was successful or not.last_update_successfulwill be the timestamp of the last successful update
from the feed. This date may be useful if the consumer of this library wants
to treat intermittent errors from feed updates differently.last_timestamp(optional, depends on the feed data) will be the latest
timestamp extracted from the feed data.
This requires that the underlying feed data actually contains a suitable
date. This date may be useful if the consumer of this library wants to
process feed entries differently if they haven't actually been updated. |
aio-georss-gdacs | python-aio-georss-gdacsThis library provides convenient async access to theGlobal Disaster Alert and Coordination System (GDACS)feeds.Installationpip install aio-georss-gdacsUsageSee below for examples of how this library can be used. After instantiating a
particular class - feed or feed manager - and supply the required parameters,
you can callupdateto retrieve the feed data. The return value
will be a tuple of a status code and the actual data in the form of a list of
feed entries specific to the selected feed.Status CodesOK: Update went fine and data was retrieved. The library may still
return empty data, for example because no entries fulfilled the filter
criteria.OK_NO_DATA: Update went fine but no data was retrieved, for example
because the server indicated that there was not update since the last request.ERROR: Something went wrong during the updateParametersParameterDescriptionhome_coordinatesCoordinates (tuple of latitude/longitude)Supported FiltersFilterDescriptionRadiusfilter_radiusRadius in kilometers around the home coordinates in which events from feed are included.Categoriesfilter_categoriesArray of category names. Only events with a category matching any of these is included. Supported/known categories are "Drought", "Earthquake", "Flood", "Tropical Cyclone", "Tsunami", "Volcano"ExampleimportasynciofromaiohttpimportClientSessionfromaio_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())Feed entry propertiesEach feed entry is populated with the following properties:NameDescriptionFeed attributegeometriesAll geometry details of this entry (except bounding boxes).georss:pointcoordinatesBest coordinates (latitude, longitude) of this entry.georss:pointexternal_idThe unique public identifier for this incident.guidtitleTitle of this entry.titleattributionAttribution of the feed.n/adistance_to_homeDistance in km of this entry to the home coordinates.n/acategoryThe alert level of the incident.gdacs:alertleveldescriptionThe description of the incident.descriptionalert_levelAlert level ("Red", "Orange", "Green").gdacs:alertlevelcountryCountry where incident happened.gdacs:countryduration_in_weekDuration of the incident in full weeks.gdacs:durationinweekevent_idEvent ID (numerical).gdacs:eventidevent_nameShort event name.gdacs:eventnameevent_type_shortShort event type ("DR, "EQ", "FL", "TC", "TS", "VO", "WF").gdacs:eventtypeevent_typeLong event type ("Drought", "Earthquake", "Flood", "Tropical Cyclone", "Tsunami", "Volcano", "Wild Fire").gdacs:eventtypefrom_dateDate and time this incident started.gdacs:fromdateicon_urlIcon URL.gdacs:iconis_currentWhether this incident is current.gdacs:iscurrentpopulationExposed population.gdacs:populationseveritySeverity of the incident.gdacs:severitytemporaryWhether this incident is temporary.gdacs:temporaryto_dateDate and time this incident ended.gdacs:todateversionVersion of the incident in this feed.gdacs:versionvulnerabilityVulnerability score (textual or numerical).gdacs:vulnerabilityFeed ManagerThe Feed Manager helps managing feed updates over time, by notifying the
consumer of the feed about new feed entries, updates and removed entries
compared to the last feed update.If the current feed update is the first one, then all feed entries will be
reported as new. The feed manager will keep track of all feed entries'
external IDs that it has successfully processed.If the current feed update is not the first one, then the feed manager will
produce three sets:Feed entries that were not in the previous feed update but are in the
current feed update will be reported as new.Feed entries that were in the previous feed update and are still in the
current feed update will be reported as to be updated.Feed entries that were in the previous feed update but are not in the
current feed update will be reported to be removed.If the current update fails, then all feed entries processed in the previous
feed update will be reported to be removed.After a successful update from the feed, the feed manager provides two
different dates:last_updatewill be the timestamp of the last update from the feed
irrespective of whether it was successful or not.last_update_successfulwill be the timestamp of the last successful update
from the feed. This date may be useful if the consumer of this library wants
to treat intermittent errors from feed updates differently.last_timestamp(optional, depends on the feed data) will be the latest
timestamp extracted from the feed data.
This requires that the underlying feed data actually contains a suitable
date. This date may be useful if the consumer of this library wants to
process feed entries differently if they haven't actually been updated. |
aioget | This is a simple script that implements concurrent downloads with Python.
It makes use of Python >= 3.5 new module’s asyncio coroutines with async / await statements.
Uses aiohttp for assyncronous downloads, aiofiles for nonblocking filesystem operations.
Has a nice curses based progress_bar with multiple lines |
aiogettext | No description available on PyPI. |
aiogetui | aiogetuiPython SDK for Getui push service based on asyncio(aiohttp).
Based onGeTui rest api.Installation$pipinstallaiogetuiBasic UsageimportasyncioimportuuidfromaiogetuiimportIGeTui,ToSingleMessage,NotificationTemplateAPP_ID=''APP_KEY=''MASTER_SECRET=''CLIENT_ID=''asyncdefrun():client=IGeTui(APP_ID,APP_KEY,MASTER_SECRET)awaitclient.auth_sign()message=ToSingleMessage(client_id=CLIENT_ID,template=NotificationTemplate({'title':'my title','text':'My text.'}),is_offline=True,# optional, default to Falsemessage_id=uuid.uuid4().hex,# optional, length 10~32)result=awaitclient.push(message)print(result)awaitclient.close()asyncio.get_event_loop().run_until_complete(run()) |
aiogh | aiogh - an async GitHub APIProject TODO |
aiogibson | aiogibsonis a library for accessing agibsoncache database
from theasyncio(PEP-3156/tulip) framework.Gibson is a high efficiency, tree based memory cache server.
It uses a specialtriestructure allowing the
user to perform operations on multiple key sets using a prefix
expression achieving the same performance grades in the worst case,
even better on an average case then regular cache implementations
based on hash tables.Code heavily reused from awesomeaioredislibrary.GibsonPool,GibsonConnection, almost direct copy ofRedisPoolandRedisConnection, so I highly recommend to checkoutaioredis.Documentationhttp://aiogibson.readthedocs.org/InstallationMake sure that you havegibsonserver compiled and running. The easiest way
to installaiogibsonis by using the package on PyPi:pip install aiogibsonExampleimportasynciofromaiogibsonimportcreate_gibsonloop=asyncio.get_event_loop()@asyncio.coroutinedefgo():gibson=yield fromcreate_gibson('/tmp/gibson.sock',loop=loop)# set valueyield fromgibson.set(b'foo',b'bar',7)yield fromgibson.set(b'numfoo',100,7)# get valueresult=yield fromgibson.get(b'foo')print(result)# set ttl to the valueyield fromgibson.ttl(b'foo',10)# increment given keyyield fromgibson.inc(b'numfoo')# decrement given keyyield fromgibson.dec(b'numfoo')# lock key from modificationyield fromgibson.lock(b'numfoo')# unlock given keyyield fromgibson.unlock(b'numfoo')# fetch keys with given prefixyield fromgibson.keys(b'foo')# delete valueyield fromgibson.delete(b'foo')loop.run_until_complete(go())Underlying data structuretrieallows us to perform operations on multiple
key sets using a prefix expression:Multi Commandsimportasynciofromaiogibsonimportcreate_gibsonloop=asyncio.get_event_loop()@asyncio.coroutinedefgo():gibson=yield fromcreate_gibson('/tmp/gibson.sock',loop=loop)# set the value for keys verifying the given prefixyield fromgibson.mset(b'fo',b'bar',7)yield fromgibson.mset(b'numfo',100,7)# get the values for keys with given prefixresult=yield fromgibson.mget(b'fo')# set the TTL for keys verifying the given prefixyield fromgibson.mttl(b'fo',10)# increment by one keys verifying the given prefix.yield fromgibson.minc(b'numfo')# decrement by one keys verifying the given prefixyield fromgibson.mdec(b'numfoo')# lock keys with prefix from modificationyield fromgibson.mlock(b'fo')# unlock keys with given prefixyield fromgibson.munlock(b'fo')# delete keys verifying the given prefix.yield fromgibson.mdelete(b'fo')# return list of keys with given prefix ``fo``yield fromgibson.keys(b'fo')# count items for a given prefiinfo=yield fromgibson.stats()loop.run_until_complete(go())aiogibsonhas connection pooling support using context-manager:Connection Pool Exampleimportasynciofromaiogibsonimportcreate_poolloop=asyncio.get_event_loop()@asyncio.coroutinedefgo():pool=yield fromcreate_pool('/tmp/gibson.sock',minsize=5,maxsize=10,loop=loop)# using context managerwith(yield frompool)asgibson:yield fromgibson.set('foo','bar')value=yield fromgibson.get('foo')print(value)# NOTE: experimental feature# or without context manageryield frompool.set('foo','bar')resp=yield frompool.get('foo')yield frompool.delete('foo')pool.clear()loop.run_until_complete(go())Also you can have simple low-level interface togibsonserver:Low Level Commandsimportasynciofromaiogibsonimportcreate_gibsonloop=asyncio.get_event_loop()@asyncio.coroutinedefgo():gibson=yield fromcreate_connection('/tmp/gibson.sock',loop=loop)# set valueyield fromgibson.execute(b'set',b'foo',b'bar',7)# get valueresult=yield fromgibson.execute(b'get',b'foo')print(result)# delete valueyield fromgibson.execute(b'del',b'foo')loop.run_until_complete(go())RequirementsPython3.3+asyncioorPython3.4+LicenseTheaiogibsonis offered under MIT license.Changes0.1.3 (2015-02-10)Documentation published onhttp://aiogibson.readthedocs.org/:Added wait closed finalizer;Improved test coverage to 99%;Fixed bug with canceled future;Added limit argument to mget command;0.1.2 (2014-10-15)Changed Reader interface to be similar to hiredis;Most methods from high level interface now return Future;Connection pool, works as drop in replacement for high level connection;Added more docstrings;0.1.1 (2014-09-06)Improved protocol parser;Added type checking in high-level commands;Added check for None arguments in connection execute command;0.1.0 (2014-08-17)Initial release; |
aiogifs | aiogifsA real readme coming soon yes i'm srry, no booli please. |
aiogithub | UNKNOWN |
aiogithubapi | aiogithubapiAsynchronous Python client for the GitHub APIThis is not a full client for the API (Have you seen it, it's huge), and will probably never be.
Things are added when needed or requested.If something you need is missing please raisea feature request to have it addedorcreate a PR 🎉.For examples on how to use it see thetests directory.Installpython3-mpipinstallaiogithubapiProject transitionNote: This project is currently in a transition phase.In august 2021 a new API interface was introduced (in#42). With that addition, all parts of the old interface is now considered deprecated.
Which includes:Theaiogithubapi.commonmoduleTheaiogithubapi.legacymoduleTheaiogithubapi.objectsmoduleAll classes starting withAIOGitHubTheasync_call_apifunction in theaiogithubapi.helpers.pyfileTheGitHubDeviceclass inaiogithubapi, replaced withGitHubDeviceAPITheGitHubclass inaiogithubapi, replaced withGitHubAPILater this year (2022), warning logs will start to be emitted for deprecated code.Early next year (2023), the old code will be removed.ContributeAllcontributions are welcome!Fork the repositoryClone the repository locally and open the devcontainer or use GitHub codespacesDo your changesLint the files withmake lintEnsure all tests passes withmake testEnsure 100% coverage withmake coverageCommit your work, and push it to GitHubCreate a PR against themainbranch |
aiogithubauth | See readme athttps://github.com/CanopyTax/aiohttp-github-auth |
aiogitignore | A simple command line tool to generate .gitignore files |
aio-gitlab | No description available on PyPI. |
aiogmailsender | This is an asynchronous Gmail client that can send emails currently.Quickstartimportasyncioimportloggingfromemail.mime.multipartimportMIMEMultipartfromemail.mime.textimportMIMETextimportaiogmailsenderasyncdefarun():sender=awaitaiogmailsender.create('<gmailusername>','<gamilpassword>',rate_limit=60,# How many emails sender sends within a minutepool_size=2,# How many clients are kept in poolretry=5,# How many times sender retries to send a message, when sending failsbackoff=30,# How long sender sleep before retry (unit. seconds)backoff_limit=300# Max backoff (everytime sender retries, the backoff time increases exponentially and the time can't be over this limit.))tasks=[]foriinrange(10):message=MIMEMultipart('alternative')message["From"]='test'message["To"]='<targetemail>'message["Subject"]=f'test{i}'part=MIMEText('test','html')message.attach(part)tasks.append(sender.send(message))awaitasyncio.gather(*tasks)if__name__=='__main__':logging.basicConfig(format="%(asctime)s%(levelname)s:%(name)s:%(message)s",level=logging.DEBUG)asyncio.run(arun()) |
aiogmaps | aiogmapsAsyncio client library for Google Maps API Web ServicesRequirementsgooglemaps>= 3.0Getting StartedpipinstallaiogmapsUsageAPI KeyimportasynciofromaiogmapsimportClientasyncdefmain(loop):api_key='xxx'asyncwithClient(api_key,loop=loop)asclient:resp=awaitclient.place(place_id='ChIJN1t_tDeuEmsRUsoyG83frY4')print(resp)if__name__=='__main__':loop=asyncio.get_event_loop()loop.run_until_complete(main(loop))Client ID & SecretimportasynciofromaiogmapsimportClientasyncdefmain(loop):client_id='xxx'client_secret='xxx'asyncwithClient(client_id=client_id,client_secret=client_secret,loop=loop)asclient:resp=awaitclient.place(place_id='ChIJN1t_tDeuEmsRUsoyG83frY4')print(resp)if__name__=='__main__':loop=asyncio.get_event_loop()loop.run_until_complete(main(loop))DocumentationThis library works as a wrapper around official googlemaps library.For detailed API referencehttps://developers.google.com/maps/documentation/https://googlemaps.github.io/google-maps-services-python/docs/ |
aiogmb | aiogmbAsync client for google’s gmb apiFree software: MIT licenseDocumentation:https://aiogmb.readthedocs.io.FeaturesTODOCreditsThis package was created withCookiecutterand theaudreyr/cookiecutter-pypackageproject template.History0.0.1 (2018-12-26)First release on PyPI. |
aio-gnutls-transport | aio_gnutls_transport - asyncio transport over GnuTLSaio_gnutls_transportprovides a python3asyncio
transportoverGnuTLS. It aims to be adrop-in replacementfor the
native SSL transport in the stdlib (and which is based on OpenSSL).It also supportshalf-closed TLS connections, in other words you can.write_eof()on TLS streams (which is not possible with the native implementation).LicenceGNU Lesser General Public License version 2.1 or any later version (LGPLv2.1+)Requirementspython >= 3.6gnutls >= 3.5cffi >= 1.0.0Supported platformsLinuxBugsBugs shall be reportedin the gitlab project. Please mark security-critical issues asconfidential.Getting startedIn most cases, usingaio_gnutls_transportis as simple as:fromaio_gnutls_transportimportssl,GnutlsEventLoopPolicyasyncio.set_event_loop_policy(GnutlsEventLoopPolicy())aio_gnutls_transport.sslis the compatibility module to be used in place of
the nativesslmodule. It provides its ownSSLContextimplementation
for GnuTLS.GnutlsEventLoopPolicyis an asyncioevent loop
policythat installs a
wrapper around the default event loop implementation to support theSSLContextobjects created by theaio_gnutls_transport.sslmodule.Configuring TLS parametersThe security properties ofGnutlsContextare configured usingGnuTLS
priority strings.aio_gnutls_transport.DEFAULT_PRIORITYholds the default priority string set byssl.create_default_context()(its current value isSECURE:-RSA:%PROFILE_MEDIUM:%SERVER_PRECEDENCEand it will be kept to a sane
default).The priority string is configurable on a per-context basis by callingGnuTLSContext.gnutls_set_priority(). For example, to disable TLS versions
older than 1.3:ctx=ssl.create_default_context()ctx.gnutls_set_priority(aio_gnutls_transport.DEFAULT_PRIORITY+":-VERS-ALL:+VERS-TLS1.3")For any details about assembling a priority string, please refer to theGnuTLS
Manual.Contents of this packageThis packages provides:itemdescriptionnative equivalentaio_gnutls_transport.GnutlsContextGnuTLS contextssl.SSLContextaio_gnutls_transport.GnutlsErrorGnuTLS error classssl.SSLErroraio_gnutls_transport.GnutlsEventLoopPolicyan asyncio event loop policy usingGnutlsEventLoopinstead of the default event loopasyncio.DefaultEventLoopPolicyaio_gnutls_transport.GnutlsEventLoopan event loop which supports GnuTLS contextsasyncio.SelectorEventLoopaio_gnutls_transport.GnutlsObjectTLS connection state objectssl.SSLObjectaio_gnutls_transport.GnutlsHandshakeProtocolasyncio protocol implementing the TLS handshakeaio_gnutls_transport.GnutlsTransportasyncio transport over GnuTLSasyncio.sslproto._SSLProtocolTransportaio_gnutls_transport.sslthesslcompatibility modulesslCaveatsTheaio_gnutls_transport.sslcompatibility module provides only a subset of
the nativesslstdlib module.Achieving 100% compatibility is a non-goal (it would not be realistic since the
native module is tightly coupled with OpenSSL).Instead we take a minimalist and conservative approach:aio_gnutls_transportonly supports the most common features and any attempt
to use an unsupported attribute/method raisesNotImplementedError.The ssl module currently provides the following definitions:ssl.SSLContextssl.create_default_context()ssl.CERT_NONEssl.CERT_OPTIONALssl.CERT_REQUIREDssl.Purposessl.VerifyModessl.DER_cert_to_PEM_certssl.PEM_cert_to_DER_certand SSLContext supports the following attributes/methods:SSLContext.check_hostnameSSLContext.load_cert_chain()SSLContext.load_verify_locations()SSLContext.load_default_certs()SSLContext.verify_modeAlso, be aware that:Errors are reported asaio_gnutls_transport.GnutlsErroris not compatible
with the nativessl.SSLErrorclass (through they both derive fromOSError).aio_gnutls_transport.ssl.SSLContextderives fromssl.SSLContext, but they
do not share their implementation. This is necessary to enable
interoperability with 3rd-party libraries (eg: aiohttp) that enforce strict
type checking. |
aio-goodreads | No description available on PyPI. |
aiogoogle | AiogoogleAsyncGoogle API clientAiogoogle makes it possible to access most of Google's public APIs which include:Google Calendar APIGoogle Drive APIGoogle Contacts APIGmail APIGoogle Maps APIYoutube APITranslate APIGoogle Sheets APIGoogle Docs APIGogle Analytics APIGoogle Books APIGoogle Fitness APIGoogle Genomics APIGoogle Cloud StorageKubernetes Engine APIAndmoreDocumentation 📑You can find the documentationhere. |
aiogoogletrans | aiogoogletrans is a [googletrans](https://github.com/ssut/py-googletrans) fork with asyncio support.Compatible with Python 3.6+FeaturesasyncioFast and reliable - it uses the same servers that
translate.google.com usesAuto language detectionBulk translationsCustomizable service URLInstallationTo install, either use things like pip with the package “aiogoogletrans”
or download the package and put the “aiogoogletrans” directory into your
python path. Anyway, it is noteworthy that, this just requires two
modules: requests and future.$pipinstallaiogoogletransBasic UsageIf source language is not given, google translate attempts to detect the
source language.>>>fromaiogoogletransimportTranslator>>>translator=Translator()>>>importasyncio>>>loop=asyncio.get_event_loop()>>>loop.run_until_complete(translator.translate('안녕하세요.'))# <Translated src=ko confidence=1.0 dest=en text=Good evening. pronunciation=Good evening.>>>>loop.run_until_complete(translator.translate('안녕하세요.',dest='ja'))# <Translated src=ko confidence=1.0 dest=ja text=こんにちは。 pronunciation=Kon'nichiwa.>>>>loop.run_until_complete(translator.translate('veritas lux mea',src='la'))# <Translated src=la confidence=1.0 dest=en text=The truth is my light pronunciation=The truth is my light>Customize service URLYou can use another google translate domain for translation. If multiple
URLs are provided it then randomly chooses a domain.>>>fromaiogoogletransimportTranslator>>>translator=Translator(service_urls=['translate.google.com','translate.google.co.kr',])Advanced Usage (Bulk)Array can be used to translate a batch of strings in a single method
call and a single HTTP session. The exact same method shown above work
for arrays as well.>>>translations=awaittranslator.translate(['The quick brown fox','jumps over','the lazy dog'],dest='ko')>>>fortranslationintranslations:...print(translation.origin,' -> ',translation.text)# The quick brown fox -> 빠른 갈색 여우# jumps over -> 이상 점프# the lazy dog -> 게으른 개GoogleTrans as a command line application$translate-husage:translate[-h][-dDEST][-sSRC][-c]textPythonGoogleTranslatorasacommand-linetoolpositionalarguments:textThetextyouwanttotranslate.optionalarguments:-h,--helpshowthishelpmessageandexit-dDEST,--destDESTThedestinationlanguageyouwanttotranslate.(Default:en)-sSRC,--srcSRCThesourcelanguageyouwanttotranslate.(Default:auto)-c,--detect$translate"veritas lux mea"-sla-den[veritas]veritasluxmea->[en]Thetruthismylight[pron.]Thetruthismylight$translate-c"안녕하세요."[ko,1]안녕하세요.Note on library usageThe maximum character limit on a single text is 15k.Due to limitations of the web version of google translate, this API
does not guarantee that the library would work properly at all times.
(so please use this library if you don’t care about stability.)If you want to use a stable API, I highly recommend you to useGoogle’s official translate
API.If you get HTTP 5xx error or errors like #6, it’s probably because
Google has banned your client IP address.VersioningThis library followsSemantic Versioningfrom
v2.0.0. Any release versioned 0.x.y is subject to backwards incompatible
changes at any time.Submitting a Pull RequestContributions to this library are always welcome and highly encouraged
:)Fork this project.Create a topic branch.Implement your feature or bug fix.Runpytest.Add a test for yout feature or bug fix.Run step 4 again. If your changes are not 100% covered, go back to
step 5.Commit and push your changes.Submit a pull request.LicenseGoogletrans is licensed under the MIT License. The terms are as
follows:The MIT License (MIT)
Copyright (c) 2015 Simone Esposito
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE. |
aiogopro | Python async I/O GoPro moduleDevelopclonepy-aiogoprocdpy-aiogopro
python3-mvenvvenvsourcevenv\bin\activate
pipinstall-e. |
aiogossip | aiogossipAsyncIO implementation of Gossip protocolReferenceGossip protocolGossip simulator |
aiogovee | aiogoveePython 3 /asyncio library for communication with Govee devices using their local API.This is my first time coding in Python, this library was written using François Wautier'saiolifxas sample / guide and adapted to communicate with the much simplerGovee Local APIInstallationThis library is published on PyPi so:pip3 install aiogoveeorpython3 -m pip install aiogoveeHow to control your Govee DevicesFirst, you need enable local API for each supported device:- Open the Govee App
- Click on the Device
- Click on the Gear signs at the top right corner
- Turn On "Lan Control"NOTE: If your don't see the "Lan Control" switch, most likely your device is not supported, you can check the Govee Local API documentation linked above to for the list of supported devices, they update this document as they add support for more devices. If your device is listed there then either your device does not have the latest firmware or its hardware version is too old and does not support this feature (I've sees reports of this from some users), at this point your best bet it to contact Govee Support about it, they are very responsive and helpful.Once you have enabled "Lan Control" for your devices, you can test the library by using the example utility to fully manage your those Devices:python3 -m aiogoveeWhile the application is running, it will run discovery over each network interface available (including VLAN interfaces) every 5s (Library default is 180s but I configured it lower for this demo utility). Devices do not always respond to the discovery broadcast but they usually all show up after a couple of discovery attempts, just let the application run for a bit longer and hit enter to refresh the list of discovered devices.At the moment the API is very limited, these are the only supported operations:- Get Status
- Turn On/Off
- Change Brightness (0-100)
- Change Color (R) (G) (B)
- Change ColorTemperature in Kelvin (0-9000)How to use the LibraryEssentially, you create an object with at least 2 methods:- register
- unregisterYou then start the GoveeListener task in asyncio, passing the object created above, the IP of the desired network interface to run discovery on (you can start multiple GoveeListeners if you have multiple network interfaces to subnets with Govee devices) and the discovery interval in seconds (180s by default). It will register any new Device it finds.Once a device is registered, there are attribute methods for any of the supported actions in the API.The easiest way is to look at themain.py which is the demo utility included as an example of how to use the library.ThanksThanks to François Wautier, his aiolifx library which provided a great learning resource and base for this project. |
aiogpt | No description available on PyPI. |
aiogql | This is a GraphQL client for Python. Plays nicely withgraphene,graphql-core,graphql-jsand any other GraphQL implementation
compatible with the spec.GQL architecture is inspired byReact-RelayandApollo-Client.Installation$ pip install aiogqlUsageThe example below shows how you can execute queries against a local
schema.fromgqlimportgql,Clientclient=Client(schema=schema)query=gql('''
{
hello
}
''')client.execute(query)LicenseMIT
License |
aiogqlc | Asynchronous/IO GraphQL clientA Python asynchronous/IO GraphQL client based onaiohttp.In addition to standard HTTP POSTqueriesandmutationsthis client fully supports
theGraphQL multipart form requests specfor file uploads
and thegraphql-ws subprotocolfor WebSocket basedsubscriptions.Read the documentationInstallationpipinstallaiogqlcBasic usageCheck thedocumentationfor detailed and more advanced usage examples.QueriesimportasyncioimportaiohttpfromaiogqlcimportGraphQLClientENDPOINT="https://swapi-graphql.netlify.app/.netlify/functions/index"document="""query {allFilms {films {title}}}"""asyncdefmain():asyncwithaiohttp.ClientSession()assession:client=GraphQLClient(ENDPOINT,session=session)response=awaitclient.execute(document)print(awaitresponse.json())if__name__=="__main__":asyncio.run(main())MutationsimportaiohttpfromaiogqlcimportGraphQLClientdocument="""mutation ($userId: ID!) {deleteUser (id: $userId) {id}}"""variables={"userId":"42",}asyncdefmain():asyncwithaiohttp.ClientSession()assession:client=GraphQLClient("https://example.com/graphql/",session=session)response=awaitclient.execute(document,variables=variables)print(awaitresponse.json())File uploadsimportaiohttpfromaiogqlcimportGraphQLClientdocument="""mutation($file: Upload!) {uploadFile(file: $file) {size}}"""variables={"file":open("test.txt","rb")}asyncdeffoo():asyncwithaiohttp.ClientSession()assession:client=GraphQLClient("https://example.com/graphql/",session=session)response=awaitclient.execute(document,variables=variables)print(awaitresponse.json())SubscriptionsimportaiohttpfromaiogqlcimportGraphQLClientdocument="""subscription($postId: ID!) {likeAdded(postId: $postId)}"""variables={"postId":"42"}asyncdefmain():asyncwithaiohttp.ClientSession()assession:client=GraphQLClient("https://example.com/graphql/",session=session)asyncwithclient.connect()asconnection:asyncforpayloadinconnection.subscribe(document,variables=variables):print(payload)DocumentationRead the documentationto learn more about queries, mutations, subscriptions, file uploads and even authentication. |
aiogram | aiogramis a modern and fully asynchronous framework forTelegram Bot APIwritten in Python 3.8 usingasyncioandaiohttp.Make your bots faster and more powerful!Documentation:🇺🇸English🇺🇦UkrainianFeaturesAsynchronous (asyncio docs,PEP 492)Has type hints (PEP 484) and can be used withmypySupportsPyPySupportsTelegram Bot API 7.1and gets fast updates to the latest versions of the Bot APITelegram Bot API integration code wasautogeneratedand can be easily re-generated when API gets updatedUpdates router (Blueprints)Has Finite State MachineUses powerfulmagic filtersMiddlewares (incoming updates and API calls)ProvidesReplies into WebhookIntegrated I18n/L10n support with GNU Gettext (or Fluent)WarningIt is strongly advised that you have prior experience working
withasynciobefore beginning to useaiogram.If you have any questions, you can visit our community chats on Telegram:🇺🇸@aiogram🇺🇦@aiogramua🇺🇿@aiogram_uz🇰🇿@aiogram_kz🇷🇺@aiogram_ru🇮🇷@aiogram_fa🇮🇹@aiogram_it🇧🇷@aiogram_br |
aiogram2 | No description available on PyPI. |
aiogram2252-page | AiogramPaginationInline 2.25.2DescriptionA simple library for aiogram 2.25.2 that allows you to easily do pagination for any Inline keyboards.Install for pip:pipinstallaiogram2252-pageCreate paginations objectfromaiogram2252_page.paginatorimportPaginatorfromaiogramimporttypeskb=types.InlineKeyboardMarkup()paginator=Paginator(data=kb,size=5)Paramsdata: Any ready-to-use keyboard InlineKeyboardMarkup or any iterable object with InlineKeyboardButton.size: The number of rows of buttons on one page, excluding the navigation bar.ReturnA paginator object that, when called, returns a ready-made keyboard with pagination.Get data for registrations handler paginatorfromaiogram2252_page.paginatorimportPaginatorfromaiogramimporttypeskb=types.InlineKeyboardMarkup()paginator=Paginator(data=kb,size=5)@dp.message_handler()asyncdefsome_func(message:types.Message):awaitmessage.answer(text='Pagination ',reply_markup=paginator())Return paginator_handler()Data for registrations paginator.ExampleimportrandomfromaiogramimportBot,Dispatcher,typesfromaiogram.contrib.fsm_storage.memoryimportMemoryStoragefromaiogram.dispatcher.filtersimportCommandStartfromaiogram.utils.executorimportExecutorfromaiogram2252_page.paginatorimportPaginatortoken=''storage=MemoryStorage()bot=Bot(token=token)dp=Dispatcher(bot,storage=storage)@dp.message_handler(CommandStart(),state='*')asyncdefstart(message:types.Message):awaitmessage.answer('Hello world!')'''row_width - this parameter indicates the number of columns in the pagination'''kb=types.InlineKeyboardMarkup(row_width=2)kb.add(*[types.InlineKeyboardButton(text=str(random.randint(1000000,10000000)),callback_data='pass')foriinrange(100)])'''size is a parameter that indicates the number of rows in a column'''paginator=Paginator(data=kb,size=5,dp=dp,callback_startswith="page:")awaitmessage.answer(text='Paginator',reply_markup=paginator())if__name__=='__main__':Executor(dp).start_polling()ScreenshotsFirst page:Second page:Last page:Clicking on the current page number returns to the first pageThe order of entries is not lost.License MIT |
aiogram2-fork | This is a fork of the aiogram 2 framework. The creator of aiogram isAlex Root Junioraiogramis a pretty simple and fully asynchronous framework forTelegram Bot APIwritten in Python 3.7 withasyncioandaiohttp. It helps you to make your bots faster and simpler.You canread the docs here.Facts about the aiogram 2.0:The aiogram version 2.25.1 was used as a basisThere is support for a stable version of the Telegram Bot API (7.0)Official aiogram resourcesNews:@aiogram_liveCommunities:🇺🇸@aiogram🇺🇦@aiogramua🇺🇿@aiogram_uz🇰🇿@aiogram_kz🇷🇺@aiogram_ru🇮🇷@aiogram_fa🇮🇹@aiogram_it🇧🇷@aiogram_brPip:aiogramDocs:ReadTheDocsSource:Github repoIssues/Bug tracker:Github issues trackerTest bot:@aiogram_botUnofficial resourcesAiogram 2.0 source:Aiogram 2.0Issues/Bug tracker:Github issues tracker aiogram 2.0 |
aiogram3b8-calendar | # Date Selection tool for Aiogram Telegram Bots## DescriptionA simple inline calendar, date selection tool for [aiogram](https://github.com/aiogram/aiogram) telegram bots written in Python.
Offers two types of date pickers:
Navigation calendar - user can either select a date or move to the next or previous month/year by clicking a singe button.
Dialog calendar - user selects year on first stage, month on next stage, day on last stageProject was forked for aiogram version 3.0.0b8 (3.0.0b7)## Usage
Install packagepip install aiogram3b8_calendarA full working example on how to use aiogram-calendar is provided inbot_example.py.
You create a calendar and add it to a message with areply_markupparameter and then you can process it in a callbackqueyhandler method using theprocess_selectionmethod.## Gif demo: |
aiogram3-calendar | Date Selection tool for Aiogram Telegram BotsDescriptionA simple inline calendar, date selection tool foraiogramtelegram bots written in Python.
Offers two types of date pickers:
Navigation calendar - user can either select a date or move to the next or previous month/year by clicking a singe button.
Dialog calendar - user selects year on first stage, month on next stage, day on last stageUsageInstall packagepip install aiogram3_calendarA full working example on how to use aiogram-calendar is provided inbot_example.py.
You create a calendar and add it to a message with areply_markupparameter and then you can process it in a callbackqueyhandler method using theprocess_selectionmethod.Gif demo: |
aiogram3-di | Example of usageimportloggingfromosimportgetenvfromtypingimportAnnotatedfromaiogramimportRouter,Bot,Dispatcherfromaiogram.typesimportMessage,Userfromaiogram3_diimportsetup_di,Dependsrouter=Router()defget_user_full_name(event_from_user:User)->str:[email protected]()asyncdefstart(message:Message,full_name:Annotated[str,Depends(get_user_full_name)])->None:awaitmessage.answer(f"Hi{full_name}")defmain()->None:logging.basicConfig(level=logging.INFO)bot=Bot(token=getenv("BOT_TOKEN"))dp=Dispatcher()dp.include_router(router)setup_di(dp)dp.run_polling(bot)if__name__=="__main__":main()Handler Dependencies.You can useDependsin the flags parameter of the handler, for example:flags={"dependencies":[Depends(verify_user)]}DetailsIt is inspired byFastAPI.If you define a normal def, your function will be called in a different thread.LicenseMIT |
aiogram3-form | aiogram3-formA library to create forms in aiogram3pipinstallaiogram3-formExampleimportasynciofromaiogramimportBot,Dispatcher,F,Router,typesfromaiogram3_formimportForm,FormFieldfromaiogram.fsm.contextimportFSMContextbot=Bot(token="YOUR_TOKEN")dispatcher=Dispatcher()router=Router()dispatcher.include_router(router)classNameForm(Form,router=router):first_name:str=FormField(enter_message_text="Enter your first name please")second_name:str=FormField(enter_message_text="Enter your second name please",filter=(F.text.len()>10)&F.text,)age:int=FormField(enter_message_text="Enter age as integer",error_message_text="Age should be numeric!",)@NameForm.submit()asyncdefname_form_submit_handler(form:NameForm,event_chat:types.Chat):# handle form data# also supports aiogram standart DI (e. g. middlewares, filters, etc)awaitform.answer(f"{form.first_name}{form.second_name}of age{form.age}in chat{event_chat.title}")@router.message(F.text=="/form")asyncdefform_handler(_,state:FSMContext):awaitNameForm.start(bot,state)# start your formasyncdefmain():awaitdispatcher.start_polling(bot)asyncio.run(main()) |
aiogram_album | aiogram albumBase [email protected](F.media_group_id)asyncdefmedia_handler(message:AlbumMessage):awaitmessage.reply(f"album\n"f"size:{len(message)}\n"f"content types:{[m.content_type.valueforminmessage]}")PyrogramAlbumMiddlewareInstallpipinstallaiogram_albumPyrogramcachetoolsTgCryptoUsage[!CAUTION]
Obtain the API key by following Telegram’s instructions and rules athttps://core.telegram.org/api/obtaining_api_idfromaiogram_album.pyrogram_album.middlewareimportPyrogramAlbumMiddlewareawaitPyrogramAlbumMiddleware.from_app_data(bot_token=BOT_TOKEN,api_id=API_ID,api_hash=API_HASH,router=dp,)orfromaiogram_album.pyrogram_album.middlewareimportPyrogramAlbumMiddlewarefrompyrogramimportClientfromaiogramimportBotbot=Bot(BOT_TOKEN)client=Client(str(bot.id),bot_token=BOT_TOKEN,api_hash=API_HASH,api_id=API_ID,no_updates=True)awaitclient.start()PyrogramAlbumMiddleware(client=client,router=dp,)TTLCacheAlbumMiddlewareInstallpipinstallaiogram_albumcachetoolsUsagefromaiogram_album.ttl_cache_middlewareimportTTLCacheAlbumMiddlewareTTLCacheAlbumMiddleware(router=dp)CountCheckAlbumMiddlewareInstallpipinstallaiogram_albumUsagefromaiogram_album.count_check_middlewareimportCountCheckAlbumMiddlewareCountCheckAlbumMiddleware(router=dp)WithoutCountCheckAlbumMiddlewareInstallpipinstallaiogram_albumUsagefromaiogram_album.no_check_count_middlewareimportWithoutCountCheckAlbumMiddlewareWithoutCountCheckAlbumMiddleware(router=dp)LockAlbumMiddlewareInstallpipinstallaiogram_albumcachetoolsUsagefromaiogram_album.lock_middlewareimportLockAlbumMiddlewareLockAlbumMiddleware(router=dp) |
aiogramarch | AiogramarchProject manager and generator for AiogramInstallationpipinstallaiogramarchHow to useaiogramarchstartproject[projectname]cdcodingbotaiogramarchstartapp[appname]aiogramarchincludeRedisaiogramarchincludeFastapiaiogramarchincludeAdminTo find out all the functions:aiogramarch--help |
aiogram-autodoc | aiogram-autodocThis package allows you to generate documentation for handlers processing commands.Supports docstrings and filter inside the handler (DescriptionFilter).Example:from aiogram import Bot, Dispatcher
from aiogram.types import Message
from aiogram_autodoc import AutoDoc, DescriptionFilter
BOT_TOKEN = '00000:something-words-in-token'
bot = Bot(BOT_TOKEN, validate_token=False)
dp = Dispatcher(bot)
dp.filters_factory.bind(DescriptionFilter)
@dp.message_handler(commands=['start'], description='Description for the function with the /start command')
async def start(msg: Message):
pass
@dp.message_handler(commands=['help'])
async def help(msg: Message):
"""Description for a function with the /help command, using docstring"""
pass
@dp.message_handler()
async def just_function(msg: Message):
"""Just a function without a command that doesn't output in result"""
pass
docs = AutoDoc(dp)
docs.parse()
result_as_dict = docs.to_dict() |
aiogram-broadcaster | Aiogram BroadcasterA simple and straightforward broadcasting implementation for aiogramInstallaiton$ pip install aiogram-broadcasterExamplesFew steps before getting started...First, you should obtain token for your bot fromBotFatherand make sure you started a conversation with the bot.Obtain your user id fromJSON Dump Botin order to test out broadcaster.Note:These and even more examples can found inexamples/directoryBase usagefromaiogram_broadcasterimportTextBroadcasterimportasyncioasyncdefmain():# Initialize a text broadcaster (you can directly pass a token)broadcaster=TextBroadcaster('USERS IDS HERE','hello!',bot_token='BOT TOKEN HERE')# Run the broadcaster and close it afterwardstry:awaitbroadcaster.run()finally:awaitbroadcaster.close_bot()if__name__=='__main__':asyncio.run(main())Embed a broadcaster in a message handlerfromaiogramimportBot,Dispatcher,typesfromaiogram_broadcasterimportMessageBroadcasterimportasyncioasyncdefmessage_handler(msg:types.Message):"""The broadcaster will flood to a user whenever it receives a message"""users=[msg.from_user.id]*5# Your users listawaitMessageBroadcaster(users,msg).run()# Run the broadcasterasyncdefmain():# Initialize a bot and a dispatcherbot=Bot(token='BOT TOKEN HERE')dp=Dispatcher(bot=bot)# Register a message handlerdp.register_message_handler(message_handler,content_types=types.ContentTypes.ANY)# Run the bot and close it afterwardstry:awaitdp.start_polling()finally:awaitbot.session.close()if__name__=='__main__':asyncio.run(main()) |
aiogram-calendar | Date Selection tool for Aiogram Telegram BotsDescriptionA simple inline calendar, date selection tool foraiogramtelegram bots written in Python.Offers two types of date pickers:Navigation calendar - user can either select a date or move to the next or previous month/year by clicking a singe button.Dialog calendar - user selects year on first stage, month on next stage, day on last stage.From version 0.2 supports aiogram 3, use version 0.1.1 with aiogram 2.Main featuresTwo calendars with abilities to navigate years, months, days altogether or in dialogAbility to set specified locale (language of captions) or inherit from user`s localeLimiting the range of dates to select fromHighlighting todays dateUsageInstall packagepip install aiogram_calendarA full working example on how to use aiogram-calendar is provided in *bot_example.py*.In example keyboard with buttons is created.Each button triggers a calendar in a different way by adding it to a message with areply_markup.reply_markup=await SimpleCalendar().start_calendar()^^ will reply with a calendar created using English localization (months and days of week captions). Locale can be overridden by passing locale argument:reply_markup=await SimpleCalendar(locale='uk_UA').start_calendar()or by getting locale from User data provided by telegram API using get_user_locale method by passingmessage.from_userto itreply_markup=await SimpleCalendar(locale=await get_user_locale(message.from_user)).start_calendar()Depending on what button of calendar user will press callback is precessed using theprocess_selectionmethod.selected, date = await SimpleCalendar(locale=await get_user_locale(callback_query.from_user)).process_selection(callback_query, callback_data)Here locale is specified fromcallback_query.from_userGif demo: |
aiogram-calendar3x | # Date Selection tool for Aiogram Telegram Bots## Description
A simple inline calendar, date selection tool for [aiogram](https://github.com/aiogram/aiogram) telegram bots written in Python.
Offers two types of date pickers:
Navigation calendar - user can either select a date or move to the next or previous month/year by clicking a singe button.
Dialog calendar - user selects year on first stage, month on next stage, day on last stage## Usage
Install packagepip install aiogram_calendarA full working example on how to use aiogram-calendar is provided inbot_example.py.
You create a calendar and add it to a message with areply_markupparameter and then you can process it in a callbackqueyhandler method using theprocess_selectionmethod.## Gif demo: |
aiogram-calendar-rus | No description available on PyPI. |
aiogram-carousel | No description available on PyPI. |
aiogram-cli | aiogram-cli (PoC)Command line interface for developersWorks only withaiogram3.0+Here is only bootstrap for CLI interface with extensions based onpkg_resourcesInstallationFrom PyPipip install aiogram-cliorpip install aiogram[cli]UsageJust run in terminalaiogramand see what you can do with it.ExampleWriting extensionsAnyaiogram-cliextension package should provide an entry point like this:[aiogram_cli.plugins]
my_extension = my_package.module:my_commandOr with poetry like this:[tool.poetry.plugins."aiogram_cli.plugins"]"builtin-about"="aiogram_cli.about:command_about""builtin-plugins"="aiogram_cli.plugins:command_plugins" |
aiogram-datepicker | Aiogram datepicker widgetInstallingpip install aiogram-datepicker --upgradeDemo:Simple usageimportloggingimportosfromdatetimeimportdatetimefromaiogramimportBot,Dispatcherfromaiogram.typesimportMessage,CallbackQueryfromaiogram.utilsimportexecutorfromaiogram_datepickerimportDatepicker,DatepickerSettingslogging.basicConfig(level=logging.INFO)bot=Bot(token=os.environ['API_TOKEN'])dp=Dispatcher(bot,run_tasks_by_default=True)def_get_datepicker_settings():returnDatepickerSettings()#some [email protected]_handler(state='*')asyncdef_main(message:Message):datepicker=Datepicker(_get_datepicker_settings())markup=datepicker.start_calendar()awaitmessage.answer('Select a date: ',reply_markup=markup)@dp.callback_query_handler(Datepicker.datepicker_callback.filter())asyncdef_process_datepicker(callback_query:CallbackQuery,callback_data:dict):datepicker=Datepicker(_get_datepicker_settings())date=awaitdatepicker.process(callback_query,callback_data)ifdate:awaitcallback_query.message.answer(date.strftime('%d/%m/%Y'))awaitcallback_query.answer()if__name__=='__main__':executor.start_polling(dp,skip_updates=True)SettingsDatepickerSettings(initial_view='day',#available views -> day, month, yearinitial_date=datetime.now().date(),#default dateviews={'day':{'show_weekdays':True,'weekdays_labels':['Mo','Tu','We','Th','Fr','Sa','Su'],'header':['prev-year','days-title','next-year'],'footer':['prev-month','select','next-month'],#if you don't need select action, you can remove it and the date will return automatically without waiting for the button select#available actions -> prev-year, days-title, next-year, prev-month, select, next-month, ignore},'month':{'months_labels':['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'],'header':['prev-year',['year','select'],#you can separate buttons into groups'next-year'],'footer':['select'],#available actions -> prev-year, year, next-year, select, ignore},'year':{'header':[],'footer':['prev-years','next-years'],#available actions -> prev-years, ignore, next-years}},labels={'prev-year':'<<','next-year':'>>','prev-years':'<<','next-years':'>>','days-title':'{month}{year}','selected-day':'{day}*','selected-month':'{month}*','present-day':'•{day}•','prev-month':'<','select':'Select','next-month':'>','ignore':''},custom_actions=[]#some custom actions)Custom action examplefromaiogram_datepickerimportDatepicker,DatepickerSettings,DatepickerCustomActionclassTodayAction(DatepickerCustomAction):action:str='today'label:str='Today'defget_action(self,view:str,year:int,month:int,day:int)->InlineKeyboardButton:"""Required function"""returnInlineKeyboardButton(self.label,callback_data=self._get_callback(view,self.action,year,month,day))asyncdefprocess(self,query:CallbackQuery,view:str,_date:date)->bool:"""Required function"""ifview=='day':awaitself.set_view(query,'day',datetime.now().date())returnFalseelifview=='month':awaitself.set_view(query,'month',date(_date.year,datetime.now().date().month,_date.day))returnFalseelifview=='year':awaitself.set_view(query,'month',date(datetime.now().date().year,_date.month,_date.day))returnFalsesettings=DatepickerSettings(views={'day':{'footer':['prev-month','today','next-month',['cancel']],},'month':{'footer':['today']},'year':{'header':['today'],}},custom_actions=[TodayAction]) |
aiogram-declarative | No description available on PyPI. |
aiogram-deta | aiogram on Deta.sh |
aiogram-dev2 | aiogramis a pretty simple and fully asynchronous framework forTelegram Bot APIwritten in Python 3.7 withasyncioandaiohttp. It helps you to make your bots faster and simpler.You canread the docs here.Official aiogram resourcesNews:@aiogram_liveCommunity:@aiogramRussian community:@aiogram_ruPip:aiogramDocs:ReadTheDocsSource:Github repoIssues/Bug tracker:Github issues trackerTest bot:@aiogram_bot |
aiogram-di | Aiogram DIInstallationLatest version from GitHubpip install git+https://github.com/MaximZayats/aiogram-diFrom PyPipip install -U aiogram-diUsageInitializationfromaiogram_diimportDIMiddleware@dataclassclassA:id:intdp.message.middleware(DIMiddleware({A:lambda:A(id=1),}))[email protected]()asyncdefhandler(message:Message,a:A,# <- will be injected)->None:asserta.id==1 |
aiogram-dialog | Aiogram DialogVersion status:v2.x - actual release, supports aiogram v3.xv1.x - old release, supports aiogram v2.x, critical fix onlyAboutaiogram-dialogis a framework for developing interactive messages and menus in your telegram bot like a normal GUI application.It is inspired by ideas of Android SDK and other tools.Main ideas are:split data retrieving, rendering and action processing- you need nothing to do for showing same content after some actions, also you can show same data in multiple ways.reusable widgets- you can create calendar or multiselect at any point of your application without copy-pasting its internal logiclimited scope of context- any dialog keeps some data until closed, multiple opened dialogs process their data separatelyDesigning you bot withaiogram-dialogyouthink about user, what he sees and what he does. Then you split this vision into reusable parts and design your bot combining dialogs, widows and widgets. By this moment you can review interface and add your core logic.Many components are ready for use, but you can extend and add your own widgets and even core features.For more details seedocumentationandexamplesSupported features:Rich text rendering usingformatfunction orJinja2template engine.Automatic message updating after user actionsMultiple independent dialog stacks with own data storage and transitionsInline keyboard widgets likeSwitchTo,Start,Cancelfor state switching,Calendarfor date selection and others.Stateful widgets:Checkbox,Multiselect,Counter,TextInput. They record user actions and allow you to retrieve this data later.Multiple buttons layouts including simple grouping (Group,Column), page scrolling (ScrollingGroup), repeating of same buttons for list of data (ListGroup).Sending media (like photo or video) with fileid caching and handling switching to/from message with no media.Different rules of transitions between windows/dialogs like keeping only one dialog on top of stack or force sending enw message instead of updating one.Offline HTML-preview for messages and transitions diagram. They can be used to check all states without emulating real use cases or exported for demonstration purposes.UsageExample below is suitable for aiogram_dialog v2.x and aiogram v3.xDeclaring WindowEach window consists of:Text widgets. Render text of message.Keyboard widgets. Render inline keyboardMedia widget. Renders media if needMessage handler. Called when user sends a message when window is shownData getter functions (getter=). They load data from any source which can be used in text/keyboardState. Used when switching between windowsInfo:always createStateinsideStatesGroupfromaiogram.filters.stateimportStatesGroup,Statefromaiogram_dialog.widgets.textimportFormat,Constfromaiogram_dialog.widgets.kbdimportButtonfromaiogram_dialogimportWindowclassMySG(StatesGroup):main=State()asyncdefget_data(**kwargs):return{"name":"world"}Window(Format("Hello,{name}!"),Button(Const("Empty button"),id="nothing"),state=MySG.main,getter=get_data,)Declaring dialogWindow itself can do nothing, just prepares message. To use it you need dialog:fromaiogram.filters.stateimportStatesGroup,Statefromaiogram_dialogimportDialog,WindowclassMySG(StatesGroup):first=State()second=State()dialog=Dialog(Window(...,state=MySG.first),Window(...,state=MySG.second),)Info:All windows in a dialog MUST have states from then sameStatesGroupAfter creating a dialog you need to register it into the Dispatcher and set it up using thesetup_dialogsfunction:fromaiogramimportDispatcherfromaiogram_dialogimportsetup_dialogs...dp=Dispatcher(storage=storage)# create as usualdp.include_router(dialog)setup_dialogs(dp)Then start dialog when you are ready to use it. Dialog is started viastartmethod ofDialogManagerinstance. You
should provide corresponding state to switch into (usually it is state of first window in dialog).For example in/startcommand handler:asyncdefuser_start(message:Message,dialog_manager:DialogManager):awaitdialog_manager.start(MySG.first,mode=StartMode.RESET_STACK)dp.message.register(user_start,F.text=="/start")Info:Always setmode=StartMode.RESET_STACKin your top level start command. Otherwise, dialogs are stacked just as they do
on your mobile phone, so you can reach stackoverflow error |
aiogram-dialog-data-ttl-patched | Aiogram DialogVersion status:v1.x - stable release, supports aiogram v2.x, bugfix onlyv2.x - beta, future release, supports aiogram v3.xAboutaiogram-dialogis a framework for developing interactive messages and menus in your telegram bot like a normal GUI application.It is inspired by ideas of Android SDK and other tools.Main ideas are:split data retriving, rendering and action processing- you need nothing to do for showing same content after some actions, also you can show same data in multiple ways.reusable widgets- you can create calendar or multiselect at any point of your application without copy-pasting its internal logiclimited scope of context- any dialog keeps some data until closed, multiple opened dialogs process their data separatelyDesigning you bot withaiogram-dialogyouthink about user, what he sees and what he does. Then you split this vision into reusable parts and design your bot combining dialogs, widows and widgets. By this moment you can review interface and add your core logic.Many components are ready for use, but you can extend and add your own widgets and even core features.For more details seedocumentationandexamplesSupported features:Rich text rendering usingformatfunction orJinja2template engine.Automatic message updating after user actionsMultiple independent dialog stacks with own data storage and transitionsInline keyboard widgets likeSwitchTo,Start,Cancelfor state switching,Calendarfor date selection and others.Stateful widgets:Checkbox,Multiselect,Counter,TextInput. They record user actions and allow you to retrieve this data later.Multiple buttons layouts including simple grouping (Group,Column), page scrolling (ScrollingGroup), repeating of same buttons for list of data (ListGroup).Sending media (like photo or video) with fileid caching and handling switching to/from message with no media.Different rules of transitions between windows/dialogs like keeping only one dialog on top of stack or force sending enw message instead of updating one.Offline HTML-preview for messages and transitions diagram. They can be used to check all states without emulating real use cases or exported for demonstration purposes.UsageExample below is suitable for aiogram_dialog v2.x and aiogram v3.xDeclaring WindowEach window consists of:Text widgets. Render text of message.Keyboard widgets. Render inline keyboardMedia widget. Renders media if needeMessage handler. Called when user sends a message when window is shownData getter functions (getter=). They load data from any source which can be used in text/keyboardState. Used when switching between windowsInfo:always createStateinsideStatesGroupfromaiogram.filters.stateimportStatesGroup,Statefromaiogram_dialog.widgets.textimportFormat,Constfromaiogram_dialog.widgets.kbdimportButtonfromaiogram_dialogimportWindowclassMySG(StatesGroup):main=State()asyncdefget_data(**kwargs):return{"name":"world"}Window(Format("Hello,{name}!"),Button(Const("Empty button"),id="nothing"),state=MySG.main,getter=get_data,)Declaring dialogWindow itself can do nothing, just prepares message. To use it you need dialog:fromaiogram.filters.stateimportStatesGroup,Statefromaiogram_dialogimportDialog,WindowclassMySG(StatesGroup):first=State()second=State()dialog=Dialog(Window(...,state=MySG.first),Window(...,state=MySG.second),)Info:All windows in a dialog MUST have states from then sameStatesGroupAfter creating dialog you need to register it usingDialogRegistry:fromaiogramimportDispatcherfromaiogram_dialogimportDialogRegistry...dp=Dispatcher(storage=storage)# create as usualregistry=DialogRegistry(dp)# create registryregistry.register(name_dialog)# createThen start dialog when you are ready to use it. Dialog is started viastartmethod ofDialogManagerinstance. You
should provide corresponding state to switch into (usually it is state of first window in dialog).For example in/startcommand handler:asyncdefuser_start(message:Message,dialog_manager:DialogManager):awaitdialog_manager.start(MySG.first,mode=StartMode.RESET_STACK)dp.message.register(user_start,F.text=="/start")Info:Always setmode=StartMode.RESET_STACKin your top level start command. Otherwise, dialogs are stacked just as they do
on your mobile phone, so you can reach stackoverflow error |
aiogram-dialog-extras | No description available on PyPI. |
aiogram-ext | aiogram_tools |
aiogram-faq | No description available on PyPI. |
aiogram-fastapi-server | Aiogram FastAPI ServerHandle webhook requests with FastAPI instead of aiohttpBased onhttps://github.com/aiogram/aiogram/blob/dev-3.x/aiogram/webhook/aiohttp_server.pyCheck out our aiogram bot templatehttps://github.com/4u-org/bot-template |
aiogram-fluent | No description available on PyPI. |
aiogram-forms | aiogram-formsIntroductionaiogram-formsis an addition foraiogramwhich allows you to create different forms and process user input step by step easily.DocumentationDocumentation can be foundhere.Installationpipinstallaiogram-formsUsageCreate form you need by subclassingaiogram_forms.forms.Form. Fields can be added fromaiogram_forms.forms.fieldssubpackage.fromaiogram_formsimportdispatcherfromaiogram_forms.formsimportForm,fields,FormsManagerfromaiogram_forms.errorsimportValidationErrordefvalidate_username_format(value:str):"""Validate username starts with leading @."""ifnotvalue.startswith('@'):raiseValidationError('Username should starts with "@".',code='username_prefix')@dispatcher.register('test-form')classTestForm(Form):username=fields.TextField('Username',min_length=4,validators=[validate_username_format],error_messages={'min_length':'Username must contain at least 4 characters!'})email=fields.EmailField('Email',help_text='We will send confirmation code.')phone=fields.PhoneNumberField('Phone number',share_contact=True)language=fields.ChoiceField('Language',choices=(('English','en'),('Russian','ru')))@classmethodasyncdefcallback(cls,message:types.Message,forms:FormsManager,**data)->None:data=awaitforms.get_data('test-form')# Get form data from stateawaitmessage.answer(text=f'Thank you,{data["username"]}!',reply_markup=types.ReplyKeyboardRemove()# Use this for reset if last field contains keyboard)router=Router()@router.message(Command(commands=['start']))asyncdefcommand_start(message:types.Message,forms:FormsManager)->None:awaitforms.show('test-form')# Start form processingasyncdefmain():dp=Dispatcher()dp.include_router(router)dispatcher.attach(dp)# Attach aiogram to forms dispatcherbot=Bot(...)awaitdp.start_polling(bot)HistoryAll notable changes to this project will be documented inCHANGELOGfile. |
aiogram-i18n | aiogram_i18nInstallation:pip install aiogram_i18nTo use FluentCompileCore:pip install fluent_compilerTo use FluentRuntimeCore:pip install fluent.runtimeimportasynciofromcontextlibimportsuppressfromloggingimportbasicConfig,INFOfromtypingimportAnyfromaiogramimportRouter,Dispatcher,F,Botfromaiogram.enumsimportParseModefromaiogram.filtersimportCommandStartfromaiogram.typesimportMessagefromaiogram_i18nimportI18nContext,LazyProxy,I18nMiddlewarefromaiogram_i18n.cores.fluent_runtime_coreimportFluentRuntimeCorefromaiogram_i18n.typesimport(ReplyKeyboardMarkup,KeyboardButton# you should import mutable objects from here if you want to use LazyProxy in them)router=Router(name=__name__)rkb=ReplyKeyboardMarkup(keyboard=[[KeyboardButton(text=LazyProxy("help"))]# or L.help()],resize_keyboard=True)@router.message(CommandStart())asyncdefcmd_start(message:Message,i18n:I18nContext)->Any:name=message.from_user.mention_html()returnmessage.reply(text=i18n.get("hello",user=name),# or i18n.hello(user=name)reply_markup=rkb)@router.message(F.text==LazyProxy("help"))asyncdefcmd_help(message:Message)->Any:returnmessage.reply(text="-- "+message.text+" --")asyncdefmain()->None:basicConfig(level=INFO)bot=Bot("42:ABC",parse_mode=ParseMode.HTML)i18n_middleware=I18nMiddleware(core=FluentRuntimeCore(path="locales/{locale}/LC_MESSAGES"))dp=Dispatcher()dp.include_router(router)i18n_middleware.setup(dispatcher=dp)awaitdp.start_polling(bot)if__name__=="__main__":withsuppress(KeyboardInterrupt):asyncio.run(main()) |
aiogramic | python -m aiogramic create:<EntityType>
Types: handler, callback_datapython -m aiogramic create:middleware <HandlerType> <HandlerName> [options]
Options:
-s, --state |
aiogram-inline-paginations | aiogram-inline-paginationsDescriptionA simple library for aiogram that allows you to easily do pagination for any Inline keyboards.Install for pip:pipinstallaiogram-inline-paginationsInstall for poetry:poetryaddaiogram-inline-paginationsCreate paginations objectfromaiogram_inline_paginations.paginatorimportPaginatorfromaiogramimporttypeskb=types.InlineKeyboardMarkup()paginator=Paginator(data=kb,size=5)Paramsdata: Any ready-to-use keyboard InlineKeyboardMarkup or any iterable object with InlineKeyboardButton.size: The number of rows of buttons on one page, excluding the navigation bar.ReturnA paginator object that, when called, returns a ready-made keyboard with pagination.Get data for registrations handler paginatorfromaiogram_inline_paginations.paginatorimportPaginatorfromaiogramimporttypeskb=types.InlineKeyboardMarkup()paginator=Paginator(data=kb,size=5)@dp.message_handler()asyncdefsome_func(message:types.Message):awaitmessage.answer(text='Some menu',reply_markup=paginator())Return paginator_handler()Data for registrations paginator.ExampleimportrandomfromaiogramimportBot,Dispatcher,typesfromaiogram.contrib.fsm_storage.memoryimportMemoryStoragefromaiogram.dispatcher.filtersimportCommandStartfromaiogram.utils.executorimportExecutorfromaiogram_inline_paginations.paginatorimportPaginatortoken='your token'storage=MemoryStorage()bot=Bot(token=token)dp=Dispatcher(bot,storage=storage)@dp.message_handler(CommandStart(),state='*')asyncdefstart(message:types.Message):awaitmessage.answer('Hello text')kb=types.InlineKeyboardMarkup()# some keyboard'''To demonstrate, I will add more than 50 buttons to the keyboard and divide them into 5 lines per page'''kb.add(*[types.InlineKeyboardButton(text=str(random.randint(1000000,10000000)),callback_data='pass')foriinrange(2)])kb.add(*[types.InlineKeyboardButton(text=str(random.randint(1000000,10000000)),callback_data='pass')foriinrange(3)])kb.add(types.InlineKeyboardButton(text=str(random.randint(1000000,10000000)),callback_data='pass'))kb.add(*[types.InlineKeyboardButton(text=str(random.randint(1000000,10000000)),callback_data='pass')foriinrange(2)])kb.add(*[types.InlineKeyboardButton(text=str(random.randint(1000000,10000000)),callback_data='pass')foriinrange(50)])paginator=Paginator(data=kb,size=5,dp=dp)awaitmessage.answer(text='Some menu',reply_markup=paginator())if__name__=='__main__':Executor(dp).start_polling()Check box paginations exempleimportrandomfromaiogramimportBot,Dispatcher,typesfromaiogram.contrib.fsm_storage.memoryimportMemoryStoragefromaiogram.dispatcherimportFSMContextfromaiogram.dispatcher.filtersimportCommandStart,Textfromaiogram.utils.executorimportExecutorfromaiogram_inline_paginations.paginatorimportCheckBoxPaginatortoken='your token'storage=MemoryStorage()bot=Bot(token=token)dp=Dispatcher(bot,storage=storage)@dp.message_handler(CommandStart(),state='*')asyncdefstart(message:types.Message):awaitmessage.answer('Hello text')kb=types.InlineKeyboardMarkup()# some keyboardkb.add(*[types.InlineKeyboardButton(text=str(random.randint(1000000,10000000)),callback_data=f'pass_{str(random.randint(1000000,10000000))}')foriinrange(2)])kb.add(*[types.InlineKeyboardButton(text=str(random.randint(1000000,10000000)),callback_data=f'pass_{str(random.randint(1000000,10000000))}')foriinrange(3)])kb.add(types.InlineKeyboardButton(text=str(random.randint(1000000,10000000)),callback_data=f'pass_{str(random.randint(1000000,10000000))}'))kb.add(*[types.InlineKeyboardButton(text=str(random.randint(1000000,10000000)),callback_data=f'pass_{str(random.randint(1000000,10000000))}')foriinrange(2)])kb.add(*[types.InlineKeyboardButton(text=str(random.randint(1000000,10000000)),callback_data=f'pass_{str(random.randint(1000000,10000000))}')foriinrange(50)])paginator=CheckBoxPaginator(data=kb,size=5,callback_startswith='page_',callback_startswith_button='pass_',confirm_text='Approve',dp=dp)awaitmessage.answer(text='Some menu',reply_markup=paginator())@dp.callback_query_handler(Text(startswith='Approve',endswith='confirm'))asyncdefapprove(call:types.CallbackQuery,state:FSMContext):data=awaitstate.get_data()selected=data.get('page_selected',None)awaitcall.answer(text='Your selected"\n'.join(selected))if__name__=='__main__':Executor(dp).start_polling()confirim callback:f"{confirm_text}confirm"selected data:data=awaitstate.get_data()selected=data.get(f'{startswith}selected',None)ScreenshotsFirst page:Second page:Last page:The order of entries is not lost.License MIT |
aiogram-logging | aiogram-loggerSimplifies sending logs from your bots to DB.Quick start with InfluxDB + GrafanaInstall package from pippip install aiogram_loggingPrepare InlfuxDB and Grafana with thisrepo.Import and create instancesfromaiogram_loggingimportLogger,InfluxSendersender=InfluxSender(host='localhost',db='db-name',username='db-user',password='db-password')logger=Logger(sender)Create StatMiddleware to logging every incoming messageclassStatMiddleware(BaseMiddleware):def__init__(self):super(StatMiddleware,self).__init__()asyncdefon_process_message(self,message:types.Message,data:dict):awaitlogger.write_logs(self._manager.bot.id,message,parse_text=True)dp.middleware.setup(StatMiddleware())Create dashboard by yourself or import fromgrafana-dashboard.jsonYeah, you can connect several bots for one InfluxDBTODO:Explain how to manage logs from several bots in GrafanaParse more different data |
aiogram-manager | aiogram-manager |
aiogram-media-group | aiogram-media-groupaiogram handler for media groups (also known as albums)Supported driversIn-memoryRedis(aiogram 2.x only)Mongo DB(aiogram 2.x only)Installpipinstallaiogram-media-group# orpoetryaddaiogram-media-groupUsageMinimal usage example:[email protected]_handler(MediaGroupFilter(is_media_group=True),content_types=ContentType.PHOTO)@media_group_handlerasyncdefalbum_handler(messages:List[types.Message]):formessageinmessages:print(message)Checkoutexamplesfor complete usage examples |
aiogram-metrics | aiogram-metricsMessage metrics exporter for aiogram framework |
aiogram-middlewares | aiogram-middlewaresUseful & flexible middlewares for aiogram bots |
aiogram-mvc | README GOES HERE |
aiogram-oop-framework | aiogram_oop_frameworkAn extender for aiogram to make it more OOPdocs:https://aiogram-oop-framework.readthedocs.io/en/latestLive Templatesfor PyCharmYou can find live templates in "misc/idea/live templates"To just install them all import all.zip through File | Manage IDE Settings | ImportTo install some of them you should follow these instructions:copy the content of file with template which you want to addgo to File | Settings | Editor | Live Templatesadd Template Group with any name you want (not required)add Live Template to the group you created (or Python group)Paste content to the created Live TemplateClick edit variablesEdit variables as showed below:NameExpressionDefault valueSkip if definedCLASS_NAMEcapitalize(fileNameWithoutExtension())as you wish |
aiogram-pagination | aiogram-paginationThis module will help you create layered callback menus.
The module is based on the concept that each callback has all the preceding callbacks in it.INSTALLATIONpip install aiogram-paginationQUICK STARTTo create callbacks you need to use the callback factory from
the aiogram-pagination modulefromaiogram_pagination.utils.callback_stack_factoryimportCallbackStackFactorycb=CallbackStackFactory('foo','bar')You can use both the simple version of the callback stack
and the version with abbreviated callbacks.Simple version:fromaiogram_pagination.callback_stackimportSimpleCallbackStackcallback_stack=SimpleCallbackStack(callback_data={'foo':0,'bar':1,'previous':''},callback_factory=cb)callback_stack.next(callback_data={'foo':6,'bar':6},callback_factory=cb)callback_stack.previous()Version with abbreviation:fromaiogram_pagination.callback_stackimportAbbreviatedCallbackStackcallback_stack=AbbreviatedCallbackStack(callback_data={'foo':0,'bar':1,'previous':''},callback_factory=cb)callback_stack.next(callback_data={'foo':6,'bar':6},callback_factory=cb)callback_stack.previous(default='some:callback')CONFIGURATIONFor configuration, you can use any configuration file placed
in the root directory of the project or in the data folder.The module uses configs under the "callback stack" key.
the default is config.json in the data folder of the aiogram-pagination module.Example:{"callback_stack":{"storage":"redis","cache_time_limit":3600,"max_pagination_depth":false,"redis_db":1}} |
aiogram-prometheus | aiogram Prometheus ExporterModule for exporting monitoring values for PrometheusInstallationpip install aiogram-prometheusQuick startimportasyncioimportloggingfromaiogramimportBot,Dispatcherfromaiogram.fsm.storage.memoryimportMemoryStoragefromaiogram.typesimportMessagefromdecoupleimportconfigfromaiogram_prometheusimport(DispatcherAiogramCollector,PrometheusMetricMessageMiddleware,PrometheusMetricStorageMixin,PrometheusPrometheusMetricRequestMiddleware,PushGatewayClient,StorageAiogramCollector,)logging.basicConfig(level='DEBUG')logger=logging.getLogger(__name__)bot=Bot('TOKEN')# Metric requests# which are made by the target botbot.session.middleware(PrometheusPrometheusMetricRequestMiddleware())# Metric storage# Change "MemoryStorage" to your storageclass_Storage(PrometheusMetricStorageMixin,MemoryStorage):passstorage_collector=StorageAiogramCollector()storage=_Storage(storage_collector)dp=Dispatcher(storage=storage)# Metric message# which are processed by the dispatcherdp.message.middleware(PrometheusMetricMessageMiddleware())# Metric base infoDispatcherAiogramCollector(dp)@dp.startup()asyncdefon_startup(bot:Bot):# Make connect to your `PUSHGATEWAY` server# For More: https://prometheus.io/docs/practices/pushing/client=PushGatewayClient('http://localhost:9091/','job-name')client.schedule_push()@dp.message()asyncdefhandle(message:Message)->None:awaitmessage.reply('Ok')asyncio.run(dp.start_polling(bot))ContributeIssue Tracker:https://gitlab.com/rocshers/python/aiogram-prometheus/-/issuesSource Code:https://gitlab.com/rocshers/python/aiogram-prometheusBefore adding changes:makeinstall-devAfter changes:makeformattest |
aiogram-pytest | No description available on PyPI. |
aiogram-sqlite-storage | A FSM Storage for aiogram 3.0+It's a very simple FSM Storage for the aiogram 3.0+. It uses local SQLite database for storing states and data. It's possible to chose method of serializing data in the database. A 'pickle' or a 'json' are available. A 'pickle' is used as default.Installation:pipinstallaiogram-sqlite-storageUsage:fromaiogramimportDispatcher# Import SQLStorage classfromaiogram_sqlite_storage.sqlitestoreimportSQLStorage# Initialise a storage# Path to a database is optional. 'fsm_starage.db' will be created for default.# 'serializing_method' is optional. 'pickle' is a default value. Also a 'json' is possible.my_storage=SQLStorage('my_db_path.db',serializing_method='pickle')# Initialize dispetcher with the storagedp=Dispatcher(storage=my_storage)# Use your FSM states and data as usual |
aiogram-store | beta store for aiogram |
aiogram-test | No description available on PyPI. |
aiogram-tests | Aiogram Testsaiogram_testsis a testing library for bots written onaiogram📚 Simple examplesSimple handler testSimple bot:fromaiogramimportBot,Dispatcher,typesfromaiogram.fsm.contextimportFSMContext# Please, keep your bot tokens on environments, this code only examplebot=Bot('123456789:AABBCCDDEEFFaabbccddeeff-1234567890')dp=Dispatcher()@dp.message()asyncdefecho(message:types.Message,state:FSMContext)->None:awaitmessage.answer(message.text)if__name__=='__main__':dp.run_polling(bot)Test cases:importpytestfrombotimportechofromaiogram_testsimportMockedBotfromaiogram_tests.handlerimportMessageHandlerfromaiogram_tests.types.datasetimportMESSAGE@pytest.mark.asyncioasyncdeftest_echo():request=MockedBot(MessageHandler(echo))calls=awaitrequest.query(message=MESSAGE.as_object(text="Hello, Bot!"))answer_message=calls.send_messsage.fetchone()assertanswer_message.text=="Hello, Bot!"▶️Moreexamples |
aiogram-timepicker | Time Selection tool for Aiogram Telegram BotsDescriptionA simple inline time selection tool foraiogramtelegram bots written in Python.
Demo:@aiogram_timepicker_bot.Offers 9 types of panel time picker:Panel Pickers (aiogram_timepicker.panelandaiogram_timepicker.panel.single):Full Time Picker - user can select a time with hours, minutes and seconds.Minute & Second Picker - user can select a time with minutes and seconds.Single Hour Picker - user can select a hour.Single Minute Picker - user can select a minute.Single Second Picker - user can select a second.Carousel Pickers (aiogram_timepicker.carousel):Full Time Picker - user can select a time with hours, minutes and seconds with carousel.Clock Pickers (aiogram_timepicker.clock):c24 - user can select a hour between 0 and 24.c24_ts3 - user can select a minute/second between 0 and 57 with 3 timestamp.c60_ts5 - user can select a minute/second between 0 and 55 with 5 timestamp.UsageInstall package with pippip install aiogram_timepickerA full working example on how to use aiogram-timepicker is provided inbot_example.py.
You create a timepicker panel and add it to a message with areply_markupparameter, and then you can process it in acallbackqueyhandlermethod using theprocess_selectionmethod.DemoCode example isexamples/simple_aiogram_2.12_bot.pyand demo use@aiogram_timepicker_bot.LicenceRead more about licencehere. |
aiogram-tonconnect | 📦 aiogram TON Connect UIAiogram TON Connect UIis a middleware library that streamlines the integration
ofTON Connecttechnology into Telegram bots based
onaiogram. It offers a pre-built user interface and orchestrates the interaction flow
for connecting wallets and initiating transactions. The library takes care of all user interactions with TON Connect
within the bot, encompassing the presentation of QR codes, texts, and keyboards, along with the handling of timeouts and
user cancellations.Check out thedocumentation.Bot [email protected] install aiogram-tonconnectFeaturesReady-to-Use User InterfaceMiddleware FunctionalityInterface CustomizationMultilingual SupportQR Code GenerationScreenshotsAcknowledgmentsThis project utilizes the following dependencies to enhance its functionality:aiogram:An asynchronous framework for building Telegram bots.pytonconnect:Python SDK for TON Connect 2.0.pytoniq-core:TON Blockchain primitives.qrcode-fastapi:Generate QR codes with optional image inclusion,
supports base64-encoded.and more...We extend our gratitude to the maintainers and contributors of these libraries for their valuable contributions to the
open-source community.ContributionWe welcome your contributions! If you have ideas for improvement or have identified a bug, please create an issue or
submit a pull request.DonationsTON-EQC-3ilVr-W0Uc3pLrGJElwSaFxvhXXfkiQA3EwdVBHNNessUSDT(TRC-20) -TJjADKFT2i7jqNJAxkgeRm5o9uarcoLUeRLicenseThis repository is distributed under
theMIT License. Feel free to use, modify, and
distribute the code in accordance with the terms of the license. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.