@@ -246,19 +246,32 @@ Here's an example for retrieving **Warzone** full profile history of a player wh
246
246
.. code-block :: python
247
247
248
248
from cod_api import API , platforms
249
+ import asyncio
249
250
250
251
# initiating the API class
251
252
api = API()
252
253
253
254
# loggin in with sso token
254
255
api.login(' your_sso_token' )
255
256
257
+ # # sync
256
258
# retrieving combat history
257
259
profile = api.Warzone.fullData(platforms.Battlenet, " Username#1234" ) # returns data of type dict
258
260
259
261
# printing results to console
260
262
print (profile)
261
263
264
+ # # async
265
+ # in an async function
266
+ async def example ():
267
+ # retrieving combat history
268
+ profile = await api.Warzone.fullDataAsync(platforms.Battlenet, " Username#1234" ) # returns data of type dict
269
+
270
+ # printing results to console
271
+ print (profile)
272
+
273
+ # CALL THE example FUNCTION IN AN ASYNC ENVIRONMENT
274
+
262
275
263
276
Combat History
264
277
--------------
@@ -282,12 +295,24 @@ Here's an example for retrieving **Warzone** combat history of a player whose ga
282
295
# loggin in with sso token
283
296
api.login(' your_sso_token' )
284
297
298
+ # # sync
285
299
# retrieving combat history
286
300
hist = api.Warzone.combatHistory(platforms.Battlenet, " Username#1234" ) # returns data of type dict
287
301
288
302
# printing results to console
289
303
print (hist)
290
304
305
+ # # async
306
+ # in an async function
307
+ async def example ():
308
+ # retrieving combat history
309
+ hist = await api.Warzone.combatHistoryAsync(platforms.Battlenet, " Username#1234" ) # returns data of type dict
310
+
311
+ # printing results to console
312
+ print (hist)
313
+
314
+ # CALL THE example FUNCTION IN AN ASYNC ENVIRONMENT
315
+
291
316
The ``combatHistoryWithDate() `` takes 4 input parameteres which are ``platform ``, ``gamertag ``, ``start `` and ``end `` of
292
317
type `cod_api.platforms `_, string, int and int respectively.
293
318
@@ -307,11 +332,23 @@ platform **Activision** with in the timestamps **1657919309** (Friday, 15 July 2
307
332
# loggin in with sso token
308
333
api.login(' your_sso_token' )
309
334
335
+ # # sync
310
336
# retrieving combat history
311
337
hist = api.Warzone.combatHistoryWithDate(platforms.Activision, " Username#1234567" , 1657919309 , 1657949309 ) # returns data of type dict
312
338
313
339
# printing results to console
314
340
print (hist)
341
+
342
+ # # async
343
+ # in an async function
344
+ async def example ():
345
+ # retrieving combat history
346
+ hist = await api.Warzone.combatHistoryWithDateAsync(platforms.Battlenet, " Username#1234" , 1657919309 , 1657949309 ) # returns data of type dict
347
+
348
+ # printing results to console
349
+ print (hist)
350
+
351
+ # CALL THE example FUNCTION IN AN ASYNC ENVIRONMENT
315
352
316
353
Additionally the methods ``breakdown() `` and ``breakdownWithDate() `` can be used to retrieve combat history without
317
354
details, where only the platform played on, game title, UTC timestamp, type ID, match ID and map ID is returned for
@@ -334,12 +371,24 @@ on platform **Battlenet**:
334
371
# loggin in with sso token
335
372
api.login(' your_sso_token' )
336
373
374
+ # # sync
337
375
# retrieving combat history breakdown
338
376
hist_b = api.Warzone.breakdown(platforms.Battlenet, " Username#1234" ) # returns data of type dict
339
377
340
378
# printing results to console
341
379
print (hist_b)
342
380
381
+ # # async
382
+ # in an async function
383
+ async def example ():
384
+ # retrieving combat history breakdown
385
+ hist_b = await api.Warzone.breakdownAsync(platforms.Battlenet, " Username#1234" ) # returns data of type dict
386
+
387
+ # printing results to console
388
+ print (hist_b)
389
+
390
+ # CALL THE example FUNCTION IN AN ASYNC ENVIRONMENT
391
+
343
392
The ``breakdownWithDate() `` takes 4 input parameteres which are ``platform ``, ``gamertag ``, ``start `` and ``end `` of
344
393
type `cod_api.platforms `_, string, int and int respectively.
345
394
@@ -359,12 +408,24 @@ and **1657949309** (Saturday, 16 July 2022 05:28:29):
359
408
# loggin in with sso token
360
409
api.login(' your_sso_token' )
361
410
411
+ # # sync
362
412
# retrieving combat history breakdown
363
413
hist_b = api.Warzone.breakdownWithDate(platforms.Activision, " Username#1234567" , 1657919309 , 1657949309 ) # returns data of type dict
364
414
365
415
# printing results to console
366
416
print (hist_b)
367
417
418
+ # # async
419
+ # in an async function
420
+ async def example ():
421
+ # retrieving combat history breakdown
422
+ hist_b = await api.Warzone.breakdownWithDateAsync(platforms.Battlenet, " Username#1234" , 1657919309 , 1657949309 ) # returns data of type dict
423
+
424
+ # printing results to console
425
+ print (hist_b)
426
+
427
+ # CALL THE example FUNCTION IN AN ASYNC ENVIRONMENT
428
+
368
429
Match Details
369
430
-------------
370
431
@@ -391,12 +452,24 @@ on platform **Battlenet**:
391
452
# loggin in with sso token
392
453
api.login(' your_sso_token' )
393
454
455
+ # # sync
394
456
# retrieving match details
395
457
details = api.Warzone.matchInfo(platforms.Battlenet, 9484583876389482453 ) # returns data of type dict
396
458
397
459
# printing results to console
398
460
print (details)
399
461
462
+ # # async
463
+ # in an async function
464
+ async def example ():
465
+ # retrieving match details
466
+ details = await api.Warzone.matchInfoAsync(platforms.Battlenet, 9484583876389482453 ) # returns data of type dict
467
+
468
+ # printing results to console
469
+ print (details)
470
+
471
+ # CALL THE example FUNCTION IN AN ASYNC ENVIRONMENT
472
+
400
473
Season Loot
401
474
-----------
402
475
@@ -419,12 +492,24 @@ platform **Battlenet**:
419
492
# loggin in with sso token
420
493
api.login(' your_sso_token' )
421
494
495
+ # # sync
422
496
# retrieving season loot
423
497
loot = api.ColdWar.seasonLoot(platforms.Battlenet, " Username#1234" ) # returns data of type dict)
424
498
425
499
# printing results to console
426
500
print (loot)
427
501
502
+ # # async
503
+ # in an async function
504
+ async def example ():
505
+ # retrieving season loot
506
+ loot = await api.ColdWar.seasonLootAsync(platforms.Battlenet, 9484583876389482453 ) # returns data of type dict
507
+
508
+ # printing results to console
509
+ print (loot)
510
+
511
+ # CALL THE example FUNCTION IN AN ASYNC ENVIRONMENT
512
+
428
513
Map List
429
514
--------
430
515
@@ -446,12 +531,25 @@ Here's an example for retrieving **Vanguard** map list and available modes respe
446
531
# loggin in with sso token
447
532
api.login(' your_sso_token' )
448
533
534
+ # # sync
449
535
# retrieving maps and respective modes available
450
- maps = api.Vanguard.mapList(platforms.PSN ) # returns data of type dict)
536
+ maps = api.Vanguard.mapList(platforms.PSN ) # returns data of type dict
451
537
452
538
# printing results to console
453
539
print (maps)
454
540
541
+ # # async
542
+ # in an async function
543
+ async def example ():
544
+ # retrieving season loot
545
+ maps = await api.Vanguard.mapListAsync(platforms.PSN ) # returns data of type dict
546
+
547
+ # printing results to console
548
+ print (maps)
549
+
550
+ # CALL THE example FUNCTION IN AN ASYNC ENVIRONMENT
551
+
552
+
455
553
.. _cod_api.platforms :
456
554
457
555
platforms
@@ -537,11 +635,23 @@ logged in with
537
635
# loggin in with sso token
538
636
api.login(' your_sso_token' )
539
637
638
+ # # sync
540
639
# retrieving user friend feed
541
640
friendFeed = api.Me.friendFeed() # returns data of type dict
542
641
543
642
# printing results to console
544
643
print (friendFeed)
644
+
645
+ # # async
646
+ # in an async function
647
+ async def example ():
648
+ # retrieving user friend feed
649
+ friendFeed = await api.Me.friendFeedAsync() # returns data of type dict
650
+
651
+ # printing results to console
652
+ print (friendFeed)
653
+
654
+ # CALL THE example FUNCTION IN AN ASYNC ENVIRONMENT
545
655
546
656
User Event Feed
547
657
----------------
@@ -559,12 +669,24 @@ logged in with
559
669
# loggin in with sso token
560
670
api.login(' your_sso_token' )
561
671
672
+ # # sync
562
673
# retrieving user event feed
563
674
eventFeed = api.Me.eventFeed() # returns data of type dict
564
675
565
676
# printing results to console
566
677
print (eventFeed)
567
678
679
+ # # async
680
+ # in an async function
681
+ async def example ():
682
+ # retrieving user event feed
683
+ eventFeed = await api.Me.eventFeedAsync() # returns data of type dict
684
+
685
+ # printing results to console
686
+ print (eventFeed)
687
+
688
+ # CALL THE example FUNCTION IN AN ASYNC ENVIRONMENT
689
+
568
690
User Identities
569
691
----------------
570
692
@@ -581,12 +703,24 @@ sso-token logged in with
581
703
# loggin in with sso token
582
704
api.login(' your_sso_token' )
583
705
706
+ # # sync
584
707
# retrieving user identities
585
708
identities = api.Me.loggedInIdentities() # returns data of type dict
586
709
587
710
# printing results to console
588
711
print (identities)
589
712
713
+ # # async
714
+ # in an async function
715
+ async def example ():
716
+ # retrieving user identities
717
+ identities = await api.Me.loggedInIdentitiesAsync() # returns data of type dict
718
+
719
+ # printing results to console
720
+ print (identities)
721
+
722
+ # CALL THE example FUNCTION IN AN ASYNC ENVIRONMENT
723
+
590
724
User COD Points
591
725
----------------
592
726
@@ -603,12 +737,24 @@ logged in with
603
737
# loggin in with sso token
604
738
api.login(' your_sso_token' )
605
739
740
+ # # sync
606
741
# retrieving user cod points
607
742
cp = api.Me.codPoints() # returns data of type dict
608
743
609
744
# printing results to console
610
745
print (cp)
611
746
747
+ # # async
748
+ # in an async function
749
+ async def example ():
750
+ # retrieving user cod points
751
+ cp = await api.Me.codPointsAsync() # returns data of type dict
752
+
753
+ # printing results to console
754
+ print (cp)
755
+
756
+ # CALL THE example FUNCTION IN AN ASYNC ENVIRONMENT
757
+
612
758
User Accounts
613
759
----------------
614
760
@@ -625,12 +771,24 @@ the sso-token logged in with
625
771
# loggin in with sso token
626
772
api.login(' your_sso_token' )
627
773
774
+ # # sync
628
775
# retrieving user connected accounts
629
- accounts = api.Me.codPoints () # returns data of type dict
776
+ accounts = api.Me.connectedAccounts () # returns data of type dict
630
777
631
778
# printing results to console
632
779
print (accounts)
633
780
781
+ # # async
782
+ # in an async function
783
+ async def example ():
784
+ # retrieving user connected accounts
785
+ accounts = await api.Me.connectedAccountsAsync() # returns data of type dict
786
+
787
+ # printing results to console
788
+ print (accounts)
789
+
790
+ # CALL THE example FUNCTION IN AN ASYNC ENVIRONMENT
791
+
634
792
User settings
635
793
----------------
636
794
@@ -647,18 +805,33 @@ in with
647
805
# loggin in with sso token
648
806
api.login(' your_sso_token' )
649
807
808
+ # # sync
650
809
# retrieving user settings
651
810
settings = api.Me.settings() # returns data of type dict
652
811
653
812
# printing results to console
654
813
print (settings)
655
814
815
+ # # async
816
+ # in an async function
817
+ async def example ():
818
+ # retrieving user settings
819
+ settings = await api.Me.settingsAsync() # returns data of type dict
820
+
821
+ # printing results to console
822
+ print (settings)
823
+
824
+ # CALL THE example FUNCTION IN AN ASYNC ENVIRONMENT
825
+
656
826
-------------------------------------------------------------------------------------------------------------------------------
657
827
658
828
Donate
659
829
======
660
830
661
- `Donate Todo Lodo `_ and `Donate Engineer152 `_
831
+ * `Donate Todo Lodo `_
832
+ * `Donate Engineer152 `_
833
+ * `Donate Werseter `_
662
834
663
- .. _Donate Engineer152 : https://www.paypal.com/paypalme/engineer15
664
835
.. _Donate Todo Lodo : https://www.buymeacoffee.com/todolodo2089
836
+ .. _Donate Engineer152 : https://www.paypal.com/paypalme/engineer15
837
+ .. _Donate Werseter : https://paypal.me/werseter
0 commit comments