-
Notifications
You must be signed in to change notification settings - Fork 259
Expand file tree
/
Copy pathazure.storage.queue.QueueClient.yml
More file actions
1165 lines (939 loc) · 49.2 KB
/
azure.storage.queue.QueueClient.yml
File metadata and controls
1165 lines (939 loc) · 49.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
### YamlMime:PythonClass
uid: azure.storage.queue.QueueClient
name: QueueClient
fullName: azure.storage.queue.QueueClient
module: azure.storage.queue
summary: 'A client to interact with a specific Queue.
For more optional configuration, please click
[here](https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-queue#optional-configuration).'
constructor:
syntax: 'QueueClient(account_url: str, queue_name: str, credential: str | Dict[str,
str] | AzureNamedKeyCredential | AzureSasCredential | TokenCredential | None =
None, *, api_version: str | None = None, secondary_hostname: str | None = None,
message_encode_policy: BinaryBase64EncodePolicy | TextBase64EncodePolicy | None
= None, message_decode_policy: BinaryBase64DecodePolicy | TextBase64DecodePolicy
| None = None, audience: str | None = None, **kwargs: Any)'
parameters:
- name: account_url
description: 'The URL to the storage account. In order to create a client given
the full URI to the queue,
use the <xref:azure.storage.queue.QueueClient.from_queue_url> classmethod.'
isRequired: true
types:
- <xref:str>
- name: queue_name
description: The name of the queue.
isRequired: true
types:
- <xref:str>
- name: credential
description: 'The credentials with which to authenticate. This is optional if
the
account URL already has a SAS token. The value can be a SAS token string,
an instance of a AzureSasCredential or AzureNamedKeyCredential from azure.core.credentials,
an account shared access key, or an instance of a TokenCredentials class from
azure.identity.
If the resource URI already contains a SAS token, this will be ignored in favor
of an explicit credential
- except in the case of AzureSasCredential, where the conflicting SAS tokens
will raise a ValueError.
If using an instance of AzureNamedKeyCredential, "name" should be the storage
account name, and "key"
should be the storage account key.'
defaultValue: None
types:
- <xref:azure.core.credentials.AzureNamedKeyCredential>
- <xref:azure.core.credentials.AzureSasCredential>
- <xref:azure.core.credentials.TokenCredential>
- <xref:str>
- <xref:dict>[<xref:str>, <xref:str>]
- <xref:None>
keywordOnlyParameters:
- name: api_version
description: 'The Storage API version to use for requests. Default value is the
most recent service version that is
compatible with the current SDK. Setting to an older version may result in reduced
feature compatibility.'
defaultValue: None
types:
- <xref:str>
- name: secondary_hostname
description: The hostname of the secondary endpoint.
defaultValue: None
types:
- <xref:str>
- name: message_encode_policy
description: 'The encoding policy to use on outgoing messages.
Default is not to encode messages. Other options include ~azure.storage.queue.TextBase64EncodePolicy,
~azure.storage.queue.BinaryBase64EncodePolicy or *None*.'
defaultValue: None
types:
- <xref:azure.storage.queue.BinaryBase64EncodePolicy>
- <xref:azure.storage.queue.TextBase64EncodePolicy>
- <xref:None>
- name: message_decode_policy
description: 'The decoding policy to use on incoming messages.
Default value is not to decode messages. Other options include ~azure.storage.queue.TextBase64DecodePolicy,
~azure.storage.queue.BinaryBase64DecodePolicy or *None*.'
defaultValue: None
types:
- <xref:azure.storage.queue.BinaryBase64DecodePolicy>
- <xref:azure.storage.queue.TextBase64DecodePolicy>
- <xref:None>
- name: audience
description: 'The audience to use when requesting tokens for Azure Active Directory
authentication. Only has an effect when credential is of type TokenCredential.
The value could be
[https://storage.azure.com/](https://storage.azure.com/) (default) or [https:/](https:/)/<account>.queue.core.windows.net.'
defaultValue: None
types:
- <xref:str>
examples:
- "Create the queue client with url and credential.<!--[!code-python[Main](les\\queue_samples_message.py\
\ )]-->\n\n<!-- literal_block {\"ids\": [], \"classes\": [], \"names\": [], \"dupnames\"\
: [], \"backrefs\": [], \"source\": \"C:\\\\ToolCache\\\\Python\\\\3.12.10\\\\x64\\\
\\Lib\\\\site-packages\\\\py2docfx\\\\dist_temp\\\\276\\\\azure_storage_queue-12.16.0\\\
\\samples\\\\queue_samples_message.py\", \"xml:space\": \"preserve\", \"force\"\
: false, \"language\": \"python\", \"highlight_args\": {\"linenostart\": 1}, \"\
linenos\": false} -->\n\n````python\n\n token_auth_queue = QueueClient.from_queue_url(queue_url=queue.url,\
\ credential=sas_token)\n\n ````\n"
methods:
- uid: azure.storage.queue.QueueClient.clear_messages
name: clear_messages
summary: Deletes all messages from the specified queue.
signature: 'clear_messages(*, timeout: int | None = None, **kwargs: Any) -> None'
keywordOnlyParameters:
- name: timeout
description: 'Sets the server-side timeout for the operation in seconds. For more
details see
[https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations](https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations).
This value is not tracked or validated on the client. To configure client-side
network timesouts
see [here](https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-queue#other-client--per-operation-configuration).'
defaultValue: None
types:
- <xref:int>
examples:
- "Clears all messages.<!--[!code-python[Main](les\\queue_samples_message.py )]-->\n\
\n<!-- literal_block {\"ids\": [], \"classes\": [], \"names\": [], \"dupnames\"\
: [], \"backrefs\": [], \"source\": \"C:\\\\ToolCache\\\\Python\\\\3.12.10\\\\\
x64\\\\Lib\\\\site-packages\\\\py2docfx\\\\dist_temp\\\\276\\\\azure_storage_queue-12.16.0\\\
\\samples\\\\queue_samples_message.py\", \"xml:space\": \"preserve\", \"force\"\
: false, \"language\": \"python\", \"highlight_args\": {\"linenostart\": 1}, \"\
linenos\": false} -->\n\n````python\n\n queue.clear_messages()\n\n ````\n"
- uid: azure.storage.queue.QueueClient.close
name: close
summary: 'This method is to close the sockets opened by the client.
It need not be used when using with a context manager.'
signature: close() -> None
return:
description: None
types:
- <xref:None>
- uid: azure.storage.queue.QueueClient.create_queue
name: create_queue
summary: 'Creates a new queue in the storage account.
If a queue with the same name already exists, the operation fails with
a *ResourceExistsError*.'
signature: 'create_queue(*, metadata: Dict[str, str] | None = None, timeout: int
| None = None, **kwargs: Any) -> None'
keywordOnlyParameters:
- name: metadata
description: 'A dict containing name-value pairs to associate with the queue as
metadata. Note that metadata names preserve the case with which they
were created, but are case-insensitive when set or read.'
defaultValue: None
types:
- <xref:typing.Dict>[<xref:str>, <xref:str>]
- name: timeout
description: 'Sets the server-side timeout for the operation in seconds. For more
details see
[https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations](https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations).
This value is not tracked or validated on the client. To configure client-side
network timesouts
see [here](https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-queue#other-client--per-operation-configuration).'
defaultValue: None
types:
- <xref:int>
return:
description: None or the result of cls(response)
types:
- <xref:None>
exceptions:
- type: StorageErrorException
examples:
- "Create a queue.<!--[!code-python[Main](les\\queue_samples_hello_world.py )]-->\n\
\n<!-- literal_block {\"ids\": [], \"classes\": [], \"names\": [], \"dupnames\"\
: [], \"backrefs\": [], \"source\": \"C:\\\\ToolCache\\\\Python\\\\3.12.10\\\\\
x64\\\\Lib\\\\site-packages\\\\py2docfx\\\\dist_temp\\\\276\\\\azure_storage_queue-12.16.0\\\
\\samples\\\\queue_samples_hello_world.py\", \"xml:space\": \"preserve\", \"force\"\
: false, \"language\": \"python\", \"highlight_args\": {\"linenostart\": 1}, \"\
linenos\": false} -->\n\n````python\n\n queue.create_queue()\n\n ````\n"
- uid: azure.storage.queue.QueueClient.delete_message
name: delete_message
summary: 'Deletes the specified message.
Normally after a client retrieves a message with the receive messages operation,
the client is expected to process and delete the message. To delete the
message, you must have the message object itself, or two items of data: id and
pop_receipt.
The id is returned from the previous receive_messages operation. The
pop_receipt is returned from the most recent <xref:azure.storage.queue.QueueClient.receive_messages>
or
<xref:azure.storage.queue.QueueClient.update_message> operation. In order for
the delete_message operation
to succeed, the pop_receipt specified on the request must match the
pop_receipt returned from the <xref:azure.storage.queue.QueueClient.receive_messages>
or <xref:azure.storage.queue.QueueClient.update_message>
operation.'
signature: 'delete_message(message: str | QueueMessage, pop_receipt: str | None
= None, *, timeout: int | None = None, **kwargs: Any) -> None'
parameters:
- name: message
description: The message object or id identifying the message to delete.
isRequired: true
types:
- <xref:str>
- <xref:azure.storage.queue.QueueMessage>
- name: pop_receipt
description: 'A valid pop receipt value returned from an earlier call
to the <xref:azure.storage.queue.QueueClient.receive_messages> or <xref:azure.storage.queue.QueueClient.update_message>.'
defaultValue: None
types:
- <xref:str>
keywordOnlyParameters:
- name: timeout
description: 'Sets the server-side timeout for the operation in seconds. For more
details see
[https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations](https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations).
This value is not tracked or validated on the client. To configure client-side
network timesouts
see [here](https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-queue#other-client--per-operation-configuration).'
defaultValue: None
types:
- <xref:int>
examples:
- "Delete a message.<!--[!code-python[Main](les\\queue_samples_message.py )]-->\n\
\n<!-- literal_block {\"ids\": [], \"classes\": [], \"names\": [], \"dupnames\"\
: [], \"backrefs\": [], \"source\": \"C:\\\\ToolCache\\\\Python\\\\3.12.10\\\\\
x64\\\\Lib\\\\site-packages\\\\py2docfx\\\\dist_temp\\\\276\\\\azure_storage_queue-12.16.0\\\
\\samples\\\\queue_samples_message.py\", \"xml:space\": \"preserve\", \"force\"\
: false, \"language\": \"python\", \"highlight_args\": {\"linenostart\": 1}, \"\
linenos\": false} -->\n\n````python\n\n # Get the message at the front of the\
\ queue\n msg = next(queue.receive_messages())\n\n # Delete the specified\
\ message\n queue.delete_message(msg)\n\n ````\n"
- uid: azure.storage.queue.QueueClient.delete_queue
name: delete_queue
summary: 'Deletes the specified queue and any messages it contains.
When a queue is successfully deleted, it is immediately marked for deletion
and is no longer accessible to clients. The queue is later removed from
the Queue service during garbage collection.
Note that deleting a queue is likely to take at least 40 seconds to complete.
If an operation is attempted against the queue while it was being deleted,
an ~azure.core.exceptions.HttpResponseError will be thrown.'
signature: 'delete_queue(*, timeout: int | None = None, **kwargs: Any) -> None'
keywordOnlyParameters:
- name: timeout
description: 'Sets the server-side timeout for the operation in seconds. For more
details see
[https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations](https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations).
This value is not tracked or validated on the client. To configure client-side
network timesouts
see [here](https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-queue#other-client--per-operation-configuration).'
defaultValue: None
types:
- <xref:int>
return:
types:
- <xref:None>
examples:
- "Delete a queue.<!--[!code-python[Main](les\\queue_samples_hello_world.py )]-->\n\
\n<!-- literal_block {\"ids\": [], \"classes\": [], \"names\": [], \"dupnames\"\
: [], \"backrefs\": [], \"source\": \"C:\\\\ToolCache\\\\Python\\\\3.12.10\\\\\
x64\\\\Lib\\\\site-packages\\\\py2docfx\\\\dist_temp\\\\276\\\\azure_storage_queue-12.16.0\\\
\\samples\\\\queue_samples_hello_world.py\", \"xml:space\": \"preserve\", \"force\"\
: false, \"language\": \"python\", \"highlight_args\": {\"linenostart\": 1}, \"\
linenos\": false} -->\n\n````python\n\n queue.delete_queue()\n\n ````\n"
- uid: azure.storage.queue.QueueClient.from_connection_string
name: from_connection_string
summary: Create QueueClient from a Connection String.
signature: 'from_connection_string(conn_str: str, queue_name: str, credential: str
| Dict[str, str] | AzureNamedKeyCredential | AzureSasCredential | TokenCredential
| None = None, *, api_version: str | None = None, secondary_hostname: str | None
= None, message_encode_policy: BinaryBase64EncodePolicy | TextBase64EncodePolicy
| None = None, message_decode_policy: BinaryBase64DecodePolicy | TextBase64DecodePolicy
| None = None, audience: str | None = None, **kwargs: Any) -> Self'
parameters:
- name: conn_str
description: A connection string to an Azure Storage account.
isRequired: true
types:
- <xref:str>
- name: queue_name
description: The queue name.
isRequired: true
types:
- <xref:str>
- name: credential
description: 'The credentials with which to authenticate. This is optional if
the
account URL already has a SAS token, or the connection string already has shared
access key values. The value can be a SAS token string,
an instance of a AzureSasCredential or AzureNamedKeyCredential from azure.core.credentials,
an account shared access key, or an instance of a TokenCredentials class from
azure.identity.
Credentials provided here will take precedence over those in the connection
string.
If using an instance of AzureNamedKeyCredential, "name" should be the storage
account name, and "key"
should be the storage account key.'
defaultValue: None
types:
- <xref:azure.core.credentials.AzureNamedKeyCredential>
- <xref:azure.core.credentials.AzureSasCredential>
- <xref:azure.core.credentials.TokenCredential>
- <xref:str>
- <xref:dict>[<xref:str>, <xref:str>]
- <xref:None>
keywordOnlyParameters:
- name: api_version
description: 'The Storage API version to use for requests. Default value is the
most recent service version that is
compatible with the current SDK. Setting to an older version may result in reduced
feature compatibility.'
defaultValue: None
types:
- <xref:str>
- name: secondary_hostname
description: The hostname of the secondary endpoint.
defaultValue: None
types:
- <xref:str>
- name: message_encode_policy
description: 'The encoding policy to use on outgoing messages.
Default is not to encode messages. Other options include ~azure.storage.queue.TextBase64EncodePolicy,
~azure.storage.queue.BinaryBase64EncodePolicy or *None*.'
defaultValue: None
types:
- <xref:azure.storage.queue.BinaryBase64EncodePolicy>
- <xref:azure.storage.queue.TextBase64EncodePolicy>
- <xref:None>
- name: message_decode_policy
description: 'The decoding policy to use on incoming messages.
Default value is not to decode messages. Other options include ~azure.storage.queue.TextBase64DecodePolicy,
~azure.storage.queue.BinaryBase64DecodePolicy or *None*.'
defaultValue: None
types:
- <xref:azure.storage.queue.BinaryBase64DecodePolicy>
- <xref:azure.storage.queue.TextBase64DecodePolicy>
- <xref:None>
- name: audience
description: 'The audience to use when requesting tokens for Azure Active Directory
authentication. Only has an effect when credential is of type TokenCredential.
The value could be
[https://storage.azure.com/](https://storage.azure.com/) (default) or [https:/](https:/)/<account>.queue.core.windows.net.'
defaultValue: None
types:
- <xref:str>
return:
description: A queue client.
types:
- <xref:azure.storage.queue.QueueClient>
examples:
- "Create the queue client from connection string.<!--[!code-python[Main](les\\\
queue_samples_message.py )]-->\n\n<!-- literal_block {\"ids\": [], \"classes\"\
: [], \"names\": [], \"dupnames\": [], \"backrefs\": [], \"source\": \"C:\\\\\
ToolCache\\\\Python\\\\3.12.10\\\\x64\\\\Lib\\\\site-packages\\\\py2docfx\\\\\
dist_temp\\\\276\\\\azure_storage_queue-12.16.0\\\\samples\\\\queue_samples_message.py\"\
, \"xml:space\": \"preserve\", \"force\": false, \"language\": \"python\", \"\
highlight_args\": {\"linenostart\": 1}, \"linenos\": false} -->\n\n````python\n\
\n from azure.storage.queue import QueueClient\n\n queue = QueueClient.from_connection_string(self.connection_string,\
\ \"myqueue1\")\n if queue.account_name is None:\n print(\"Connection\
\ string did not provide an account name.\" + \"\\n\" + \"Test: set_access_policy\"\
)\n sys.exit(1)\n\n ````\n"
- uid: azure.storage.queue.QueueClient.from_queue_url
name: from_queue_url
summary: A client to interact with a specific Queue.
signature: 'from_queue_url(queue_url: str, credential: str | Dict[str, str] | AzureNamedKeyCredential
| AzureSasCredential | TokenCredential | None = None, *, api_version: str | None
= None, secondary_hostname: str | None = None, message_encode_policy: BinaryBase64EncodePolicy
| TextBase64EncodePolicy | None = None, message_decode_policy: BinaryBase64DecodePolicy
| TextBase64DecodePolicy | None = None, audience: str | None = None, **kwargs:
Any) -> Self'
parameters:
- name: queue_url
description: The full URI to the queue, including SAS token if used.
isRequired: true
types:
- <xref:str>
- name: credential
description: 'The credentials with which to authenticate. This is optional if
the
account URL already has a SAS token. The value can be a SAS token string,
an instance of a AzureSasCredential or AzureNamedKeyCredential from azure.core.credentials,
an account shared access key, or an instance of a TokenCredentials class from
azure.identity.
If the resource URI already contains a SAS token, this will be ignored in favor
of an explicit credential
- except in the case of AzureSasCredential, where the conflicting SAS tokens
will raise a ValueError.
If using an instance of AzureNamedKeyCredential, "name" should be the storage
account name, and "key"
should be the storage account key.'
defaultValue: None
types:
- <xref:azure.core.credentials.AzureNamedKeyCredential>
- <xref:azure.core.credentials.AzureSasCredential>
- <xref:azure.core.credentials.TokenCredential>
- <xref:str>
- <xref:dict>[<xref:str>, <xref:str>]
- <xref:None>
keywordOnlyParameters:
- name: api_version
description: 'The Storage API version to use for requests. Default value is the
most recent service version that is
compatible with the current SDK. Setting to an older version may result in reduced
feature compatibility.'
defaultValue: None
types:
- <xref:str>
- name: secondary_hostname
description: The hostname of the secondary endpoint.
defaultValue: None
types:
- <xref:str>
- name: message_encode_policy
description: 'The encoding policy to use on outgoing messages.
Default is not to encode messages. Other options include ~azure.storage.queue.TextBase64EncodePolicy,
~azure.storage.queue.BinaryBase64EncodePolicy or *None*.'
defaultValue: None
types:
- <xref:azure.storage.queue.BinaryBase64EncodePolicy>
- <xref:azure.storage.queue.TextBase64EncodePolicy>
- <xref:None>
- name: message_decode_policy
description: 'The decoding policy to use on incoming messages.
Default value is not to decode messages. Other options include ~azure.storage.queue.TextBase64DecodePolicy,
~azure.storage.queue.BinaryBase64DecodePolicy or *None*.'
defaultValue: None
types:
- <xref:azure.storage.queue.BinaryBase64DecodePolicy>
- <xref:azure.storage.queue.TextBase64DecodePolicy>
- <xref:None>
- name: audience
description: 'The audience to use when requesting tokens for Azure Active Directory
authentication. Only has an effect when credential is of type TokenCredential.
The value could be
[https://storage.azure.com/](https://storage.azure.com/) (default) or [https:/](https:/)/<account>.queue.core.windows.net.'
defaultValue: None
types:
- <xref:str>
return:
description: A queue client.
types:
- <xref:azure.storage.queue.QueueClient>
- uid: azure.storage.queue.QueueClient.get_queue_access_policy
name: get_queue_access_policy
summary: 'Returns details about any stored access policies specified on the
queue that may be used with Shared Access Signatures.'
signature: 'get_queue_access_policy(*, timeout: int | None = None, **kwargs: Any)
-> Dict[str, AccessPolicy]'
keywordOnlyParameters:
- name: timeout
description: 'Sets the server-side timeout for the operation in seconds. For more
details see
[https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations](https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations).
This value is not tracked or validated on the client. To configure client-side
network timesouts
see [here](https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-queue#other-client--per-operation-configuration).'
defaultValue: None
types:
- <xref:int>
return:
description: A dictionary of access policies associated with the queue.
types:
- <xref:typing.Dict>[<xref:str>, <xref:azure.storage.queue.AccessPolicy>]
- uid: azure.storage.queue.QueueClient.get_queue_properties
name: get_queue_properties
summary: 'Returns all user-defined metadata for the specified queue.
The data returned does not include the queue''s list of messages.'
signature: 'get_queue_properties(*, timeout: int | None = None, **kwargs: Any) ->
QueueProperties'
keywordOnlyParameters:
- name: timeout
description: The timeout parameter is expressed in seconds.
defaultValue: None
types:
- <xref:int>
return:
description: User-defined metadata for the queue.
types:
- <xref:azure.storage.queue.QueueProperties>
examples:
- "Get the properties on the queue.<!--[!code-python[Main](les\\queue_samples_message.py\
\ )]-->\n\n<!-- literal_block {\"ids\": [], \"classes\": [], \"names\": [], \"\
dupnames\": [], \"backrefs\": [], \"source\": \"C:\\\\ToolCache\\\\Python\\\\\
3.12.10\\\\x64\\\\Lib\\\\site-packages\\\\py2docfx\\\\dist_temp\\\\276\\\\azure_storage_queue-12.16.0\\\
\\samples\\\\queue_samples_message.py\", \"xml:space\": \"preserve\", \"force\"\
: false, \"language\": \"python\", \"highlight_args\": {\"linenostart\": 1}, \"\
linenos\": false} -->\n\n````python\n\n properties = queue.get_queue_properties().metadata\n\
\n ````\n"
- uid: azure.storage.queue.QueueClient.peek_messages
name: peek_messages
summary: 'Retrieves one or more messages from the front of the queue, but does
not alter the visibility of the message.
Only messages that are visible may be retrieved. When a message is retrieved
for the first time with a call to <xref:azure.storage.queue.QueueClient.receive_messages>,
its dequeue_count property
is set to 1. If it is not deleted and is subsequently retrieved again, the
dequeue_count property is incremented. The client may use this value to
determine how many times a message has been retrieved. Note that a call
to peek_messages does not increment the value of dequeue_count, but returns
this value for the client to read.
If the key-encryption-key or resolver field is set on the local service object,
the messages will be decrypted before being returned.'
signature: 'peek_messages(max_messages: int | None = None, *, timeout: int | None
= None, **kwargs: Any) -> List[QueueMessage]'
parameters:
- name: max_messages
description: 'A nonzero integer value that specifies the number of
messages to peek from the queue, up to a maximum of 32. By default,
a single message is peeked from the queue with this operation.'
defaultValue: None
types:
- <xref:int>
keywordOnlyParameters:
- name: timeout
description: 'Sets the server-side timeout for the operation in seconds. For more
details see
[https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations](https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations).
This value is not tracked or validated on the client. To configure client-side
network timesouts
see [here](https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-queue#other-client--per-operation-configuration).'
defaultValue: None
types:
- <xref:int>
return:
description: 'A list of ~azure.storage.queue.QueueMessage objects. Note that
next_visible_on and pop_receipt will not be populated as peek does
not pop the message and can only retrieve already visible messages.'
types:
- <xref:typing.List>[<xref:azure.storage.queue.QueueMessage>]
examples:
- "Peek messages.<!--[!code-python[Main](les\\queue_samples_message.py )]-->\n\n\
<!-- literal_block {\"ids\": [], \"classes\": [], \"names\": [], \"dupnames\"\
: [], \"backrefs\": [], \"source\": \"C:\\\\ToolCache\\\\Python\\\\3.12.10\\\\\
x64\\\\Lib\\\\site-packages\\\\py2docfx\\\\dist_temp\\\\276\\\\azure_storage_queue-12.16.0\\\
\\samples\\\\queue_samples_message.py\", \"xml:space\": \"preserve\", \"force\"\
: false, \"language\": \"python\", \"highlight_args\": {\"linenostart\": 1}, \"\
linenos\": false} -->\n\n````python\n\n # Peek at one message at the front of\
\ the queue\n msg = queue.peek_messages()\n\n # Peek at the last 5 messages\n\
\ messages = queue.peek_messages(max_messages=5)\n\n # Print the last 5 messages\n\
\ for message in messages:\n print(message.content)\n\n ````\n"
- uid: azure.storage.queue.QueueClient.receive_message
name: receive_message
summary: 'Removes one message from the front of the queue.
When the message is retrieved from the queue, the response includes the message
content and a pop_receipt value, which is required to delete the message.
The message is not automatically deleted from the queue, but after it has
been retrieved, it is not visible to other clients for the time interval
specified by the visibility_timeout parameter.
If the key-encryption-key or resolver field is set on the local service object,
the message will be
decrypted before being returned.'
signature: 'receive_message(*, visibility_timeout: int | None = None, timeout: int
| None = None, **kwargs: Any) -> QueueMessage | None'
keywordOnlyParameters:
- name: visibility_timeout
description: 'If not specified, the default value is 30. Specifies the
new visibility timeout value, in seconds, relative to server time.
The value must be larger than or equal to 1, and cannot be
larger than 7 days. The visibility timeout of a message cannot be
set to a value later than the expiry time. visibility_timeout
should be set to a value smaller than the time-to-live value.'
defaultValue: None
types:
- <xref:int>
- name: timeout
description: 'Sets the server-side timeout for the operation in seconds. For more
details see
[https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations](https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations).
This value is not tracked or validated on the client. To configure client-side
network timesouts
see [here](https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-queue#other-client--per-operation-configuration).'
defaultValue: None
types:
- <xref:int>
return:
description: Returns a message from the Queue or None if the Queue is empty.
types:
- <xref:azure.storage.queue.QueueMessage>
- <xref:None>
examples:
- "Receive one message from the queue.<!--[!code-python[Main](les\\queue_samples_message.py\
\ )]-->\n\n<!-- literal_block {\"ids\": [], \"classes\": [], \"names\": [], \"\
dupnames\": [], \"backrefs\": [], \"source\": \"C:\\\\ToolCache\\\\Python\\\\\
3.12.10\\\\x64\\\\Lib\\\\site-packages\\\\py2docfx\\\\dist_temp\\\\276\\\\azure_storage_queue-12.16.0\\\
\\samples\\\\queue_samples_message.py\", \"xml:space\": \"preserve\", \"force\"\
: false, \"language\": \"python\", \"highlight_args\": {\"linenostart\": 1}, \"\
linenos\": false} -->\n\n````python\n\n # Pop two messages from the front of\
\ the queue\n message1 = queue.receive_message()\n message2 = queue.receive_message()\n\
\ # We should see message 3 if we peek\n message3 = queue.peek_messages()[0]\n\
\n if not message1 or not message2 or not message3:\n raise ValueError(\"\
One of the messages are None.\")\n\n print(message1.content)\n print(message2.content)\n\
\ print(message3.content)\n\n ````\n"
- uid: azure.storage.queue.QueueClient.receive_messages
name: receive_messages
summary: 'Removes one or more messages from the front of the queue.
When a message is retrieved from the queue, the response includes the message
content and a pop_receipt value, which is required to delete the message.
The message is not automatically deleted from the queue, but after it has
been retrieved, it is not visible to other clients for the time interval
specified by the visibility_timeout parameter. The iterator will continuously
fetch messages until the queue is empty or max_messages is reached (if max_messages
is set).
If the key-encryption-key or resolver field is set on the local service object,
the messages will be
decrypted before being returned.'
signature: 'receive_messages(*, messages_per_page: int | None = None, visibility_timeout:
int | None = None, max_messages: int | None = None, timeout: int | None = None,
**kwargs: Any) -> ItemPaged[QueueMessage]'
keywordOnlyParameters:
- name: visibility_timeout
description: 'If not specified, the default value is 30. Specifies the
new visibility timeout value, in seconds, relative to server time.
The value must be larger than or equal to 1, and cannot be
larger than 7 days. The visibility timeout of a message cannot be
set to a value later than the expiry time. visibility_timeout
should be set to a value smaller than the time-to-live value.'
defaultValue: None
types:
- <xref:int>
- name: max_messages
description: An integer that specifies the maximum number of messages to retrieve
from the queue.
defaultValue: None
types:
- <xref:int>
- name: timeout
description: 'Sets the server-side timeout for the operation in seconds. For more
details see
[https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations](https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations).
This value is not tracked or validated on the client. To configure client-side
network timesouts
see [here](https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-queue#other-client--per-operation-configuration).'
defaultValue: None
types:
- <xref:int>
- name: messages_per_page
defaultValue: None
return:
description: Returns a message iterator of dict-like Message objects.
types:
- <xref:azure.core.paging.ItemPaged>[<xref:azure.storage.queue.QueueMessage>]
examples:
- "Receive messages from the queue.<!--[!code-python[Main](les\\queue_samples_message.py\
\ )]-->\n\n<!-- literal_block {\"ids\": [], \"classes\": [], \"names\": [], \"\
dupnames\": [], \"backrefs\": [], \"source\": \"C:\\\\ToolCache\\\\Python\\\\\
3.12.10\\\\x64\\\\Lib\\\\site-packages\\\\py2docfx\\\\dist_temp\\\\276\\\\azure_storage_queue-12.16.0\\\
\\samples\\\\queue_samples_message.py\", \"xml:space\": \"preserve\", \"force\"\
: false, \"language\": \"python\", \"highlight_args\": {\"linenostart\": 1}, \"\
linenos\": false} -->\n\n````python\n\n # Receive messages one-by-one\n messages\
\ = queue.receive_messages()\n for msg in messages:\n print(msg.content)\n\
\n # Receive messages by batch\n messages = queue.receive_messages(messages_per_page=5)\n\
\ for msg_batch in messages.by_page():\n for msg in msg_batch:\n \
\ print(msg.content)\n queue.delete_message(msg)\n\n ````\n"
- uid: azure.storage.queue.QueueClient.send_message
name: send_message
summary: 'Adds a new message to the back of the message queue.
The visibility timeout specifies the time that the message will be
invisible. After the timeout expires, the message will become visible.
If a visibility timeout is not specified, the default value of 0 is used.
The message time-to-live specifies how long a message will remain in the
queue. The message will be deleted from the queue when the time-to-live
period expires.
If the key-encryption-key field is set on the local service object, this method
will
encrypt the content before uploading.'
signature: 'send_message(content: object | None, *, visibility_timeout: int | None
= None, time_to_live: int | None = None, timeout: int | None = None, **kwargs:
Any) -> QueueMessage'
parameters:
- name: content
description: 'Message content. Allowed type is determined by the encode_function
set on the service. Default is str. The encoded message can be up to
64KB in size.'
isRequired: true
types:
- <xref:typing.Optional>[<xref:object>]
keywordOnlyParameters:
- name: visibility_timeout
description: 'If not specified, the default value is 0. Specifies the
new visibility timeout value, in seconds, relative to server time.
The value must be larger than or equal to 0, and cannot be
larger than 7 days. The visibility timeout of a message cannot be
set to a value later than the expiry time. visibility_timeout
should be set to a value smaller than the time-to-live value.'
defaultValue: None
types:
- <xref:int>
- name: time_to_live
description: 'Specifies the time-to-live interval for the message, in
seconds. The time-to-live may be any positive number or -1 for infinity. If
this
parameter is omitted, the default time-to-live is 7 days.'
defaultValue: None
types:
- <xref:int>
- name: timeout
description: 'Sets the server-side timeout for the operation in seconds. For more
details see
[https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations](https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations).
This value is not tracked or validated on the client. To configure client-side
network timesouts
see [here](https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-queue#other-client--per-operation-configuration).'
defaultValue: None
types:
- <xref:int>
return:
description: 'A ~azure.storage.queue.QueueMessage object.
This object is also populated with the content, although it is not
returned from the service.'
types:
- <xref:azure.storage.queue.QueueMessage>
examples:
- "Send messages.<!--[!code-python[Main](les\\queue_samples_message.py )]-->\n\n\
<!-- literal_block {\"ids\": [], \"classes\": [], \"names\": [], \"dupnames\"\
: [], \"backrefs\": [], \"source\": \"C:\\\\ToolCache\\\\Python\\\\3.12.10\\\\\
x64\\\\Lib\\\\site-packages\\\\py2docfx\\\\dist_temp\\\\276\\\\azure_storage_queue-12.16.0\\\
\\samples\\\\queue_samples_message.py\", \"xml:space\": \"preserve\", \"force\"\
: false, \"language\": \"python\", \"highlight_args\": {\"linenostart\": 1}, \"\
linenos\": false} -->\n\n````python\n\n queue.send_message(\"message1\")\n \
\ queue.send_message(\"message2\", visibility_timeout=30) # wait 30s before\
\ becoming visible\n queue.send_message(\"message3\")\n queue.send_message(\"\
message4\")\n queue.send_message(\"message5\")\n\n ````\n"
- uid: azure.storage.queue.QueueClient.set_queue_access_policy
name: set_queue_access_policy
summary: 'Sets stored access policies for the queue that may be used with Shared
Access Signatures.
When you set permissions for a queue, the existing permissions are replaced.
To update the queue''s permissions, call <xref:azure.storage.queue.QueueClient.get_queue_access_policy>
to fetch
all access policies associated with the queue, modify the access policy
that you wish to change, and then call this function with the complete
set of data to perform the update.
When you establish a stored access policy on a queue, it may take up to
30 seconds to take effect. During this interval, a shared access signature
that is associated with the stored access policy will throw an
~azure.core.exceptions.HttpResponseError until the access policy becomes active.'
signature: 'set_queue_access_policy(signed_identifiers: Dict[str, AccessPolicy],
*, timeout: int | None = None, **kwargs: Any) -> None'
parameters:
- name: signed_identifiers
description: 'SignedIdentifier access policies to associate with the queue.
This may contain up to 5 elements. An empty dict
will clear the access policies set on the service.'
isRequired: true
types:
- <xref:typing.Dict>[<xref:str>, <xref:azure.storage.queue.AccessPolicy>]
keywordOnlyParameters:
- name: timeout
description: 'Sets the server-side timeout for the operation in seconds. For more
details see
[https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations](https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations).
This value is not tracked or validated on the client. To configure client-side
network timesouts
see [here](https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-queue#other-client--per-operation-configuration).'
defaultValue: None
types:
- <xref:int>
examples:
- "Set an access policy on the queue.<!--[!code-python[Main](les\\queue_samples_message.py\
\ )]-->\n\n<!-- literal_block {\"ids\": [], \"classes\": [], \"names\": [], \"\
dupnames\": [], \"backrefs\": [], \"source\": \"C:\\\\ToolCache\\\\Python\\\\\
3.12.10\\\\x64\\\\Lib\\\\site-packages\\\\py2docfx\\\\dist_temp\\\\276\\\\azure_storage_queue-12.16.0\\\
\\samples\\\\queue_samples_message.py\", \"xml:space\": \"preserve\", \"force\"\
: false, \"language\": \"python\", \"highlight_args\": {\"linenostart\": 1}, \"\
linenos\": false} -->\n\n````python\n\n # Create an access policy\n from azure.storage.queue\
\ import AccessPolicy, QueueSasPermissions\n\n access_policy = AccessPolicy()\n\
\ access_policy.start = datetime.utcnow() - timedelta(hours=1)\n access_policy.expiry\
\ = datetime.utcnow() + timedelta(hours=1)\n access_policy.permission = QueueSasPermissions(read=True)\n\
\ identifiers = {\"my-access-policy-id\": access_policy}\n\n # Set the access\
\ policy\n queue.set_queue_access_policy(identifiers)\n\n ````\n"
- uid: azure.storage.queue.QueueClient.set_queue_metadata
name: set_queue_metadata
summary: 'Sets user-defined metadata on the specified queue.
Metadata is associated with the queue as name-value pairs.'
signature: 'set_queue_metadata(metadata: Dict[str, str] | None = None, *, timeout:
int | None = None, **kwargs: Any) -> Dict[str, Any]'
parameters:
- name: metadata
description: 'A dict containing name-value pairs to associate with the
queue as metadata.'
defaultValue: None
types:
- <xref:typing.Optional>[<xref:typing.Dict>[<xref:str>, <xref:str>]]
keywordOnlyParameters:
- name: timeout
description: 'Sets the server-side timeout for the operation in seconds. For more
details see
[https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations](https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-queue-service-operations).
This value is not tracked or validated on the client. To configure client-side
network timesouts
see [here](https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-queue#other-client--per-operation-configuration).'
defaultValue: None
types:
- <xref:int>
return:
description: A dictionary of response headers.
types:
- <xref:typing.Dict>[<xref:str>, <xref:typing.Any>]
examples:
- "Set metadata on the queue.<!--[!code-python[Main](les\\queue_samples_message.py\
\ )]-->\n\n<!-- literal_block {\"ids\": [], \"classes\": [], \"names\": [], \"\
dupnames\": [], \"backrefs\": [], \"source\": \"C:\\\\ToolCache\\\\Python\\\\\
3.12.10\\\\x64\\\\Lib\\\\site-packages\\\\py2docfx\\\\dist_temp\\\\276\\\\azure_storage_queue-12.16.0\\\
\\samples\\\\queue_samples_message.py\", \"xml:space\": \"preserve\", \"force\"\
: false, \"language\": \"python\", \"highlight_args\": {\"linenostart\": 1}, \"\
linenos\": false} -->\n\n````python\n\n metadata = {\"foo\": \"val1\", \"bar\"\
: \"val2\", \"baz\": \"val3\"}\n queue.set_queue_metadata(metadata=metadata)\n\
\n ````\n"
- uid: azure.storage.queue.QueueClient.update_message
name: update_message
summary: 'Updates the visibility timeout of a message. You can also use this
operation to update the contents of a message.
This operation can be used to continually extend the invisibility of a