MCPcopy Index your code
hub / github.com/python-telegram-bot/python-telegram-bot / Location

Class Location

src/telegram/_files/location.py:31–128  ·  view source on GitHub ↗

This object represents a point on the map. Objects of this class are comparable in terms of equality. Two objects of this class are considered equal, if their :attr:`longitude` and :attr:`latitude` are equal. Args: longitude (:obj:`float`): Longitude as defined by the sender.

Source from the content-addressed store, hash-verified

29
30
31class Location(TelegramObject):
32 """This object represents a point on the map.
33
34 Objects of this class are comparable in terms of equality. Two objects of this class are
35 considered equal, if their :attr:`longitude` and :attr:`latitude` are equal.
36
37 Args:
38 longitude (:obj:`float`): Longitude as defined by the sender.
39 latitude (:obj:`float`): Latitude as defined by the sender.
40 horizontal_accuracy (:obj:`float`, optional): The radius of uncertainty for the location,
41 measured in meters; 0-:tg-const:`telegram.Location.HORIZONTAL_ACCURACY`.
42 live_period (:obj:`int` | :class:`datetime.timedelta`, optional): Time relative to the
43 message sending date, during which the location can be updated, in seconds. For active
44 live locations only.
45
46 .. versionchanged:: v22.2
47 |time-period-input|
48 heading (:obj:`int`, optional): The direction in which user is moving, in degrees;
49 :tg-const:`telegram.Location.MIN_HEADING`-:tg-const:`telegram.Location.MAX_HEADING`.
50 For active live locations only.
51 proximity_alert_radius (:obj:`int`, optional): Maximum distance for proximity alerts about
52 approaching another chat member, in meters. For sent live locations only.
53
54 Attributes:
55 longitude (:obj:`float`): Longitude as defined by the sender.
56 latitude (:obj:`float`): Latitude as defined by the sender.
57 horizontal_accuracy (:obj:`float`): Optional. The radius of uncertainty for the location,
58 measured in meters; 0-:tg-const:`telegram.Location.HORIZONTAL_ACCURACY`.
59 live_period (:obj:`int` | :class:`datetime.timedelta`): Optional. Time relative to the
60 message sending date, during which the location can be updated, in seconds. For active
61 live locations only.
62
63 .. deprecated:: v22.2
64 |time-period-int-deprecated|
65 heading (:obj:`int`): Optional. The direction in which user is moving, in degrees;
66 :tg-const:`telegram.Location.MIN_HEADING`-:tg-const:`telegram.Location.MAX_HEADING`.
67 For active live locations only.
68 proximity_alert_radius (:obj:`int`): Optional. Maximum distance for proximity alerts about
69 approaching another chat member, in meters. For sent live locations only.
70
71 """
72
73 __slots__ = (
74 "_live_period",
75 "heading",
76 "horizontal_accuracy",
77 "latitude",
78 "longitude",
79 "proximity_alert_radius",
80 )
81
82 def __init__(
83 self,
84 longitude: float,
85 latitude: float,
86 horizontal_accuracy: float | None = None,
87 live_period: TimePeriod | None = None,
88 heading: int | None = None,

Callers 15

PollMediaTestBaseClass · 0.90
PollOptionTestBaseClass · 0.90
BusinessTestBaseClass · 0.90
test_de_json_allMethod · 0.90
test_equalityMethod · 0.90
VenueTestBaseClass · 0.90
test_equalityMethod · 0.90
locationFunction · 0.90
test_equalityMethod · 0.90
inline_queryFunction · 0.90

Calls

no outgoing calls

Tested by 10

test_de_json_allMethod · 0.72
test_equalityMethod · 0.72
test_equalityMethod · 0.72
locationFunction · 0.72
test_equalityMethod · 0.72
inline_queryFunction · 0.72
test_equalityMethod · 0.72
test_equalityMethod · 0.72
test_equalityMethod · 0.72
test_equalityMethod · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…