lazyad 0.0.34__tar.gz → 0.0.36__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of lazyad might be problematic. Click here for more details.

@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: lazyad
3
- Version: 0.0.34
3
+ Version: 0.0.36
4
4
  Summary: 基于Python的懒人包-适用于广告投放模块
5
5
  Home-page: https://gitee.com/ZeroSeeker/lazyad
6
6
  Author: ZeroSeeker
@@ -701,3 +701,137 @@ def update_budget_batch(
701
701
  json=data,
702
702
  headers=headers
703
703
  )
704
+
705
+
706
+ def get_task_result(
707
+ cookie: str,
708
+ batch_id: str
709
+ ):
710
+ """
711
+ 获取任务结果
712
+ :param cookie:
713
+ :param batch_id:
714
+ :return:
715
+ """
716
+ url = "https://cli2.mobgi.com/Toutiao/Tools/getTaskResult"
717
+ data = {"batch_id": batch_id}
718
+ headers = copy.deepcopy(default_headers)
719
+ headers["Cookie"] = cookie
720
+ return lazyrequests.lazy_requests(
721
+ method="POST",
722
+ url=url,
723
+ json=data,
724
+ headers=headers
725
+ )
726
+
727
+
728
+ def get_task_result_end(
729
+ cookie: str,
730
+ batch_id: str
731
+ ):
732
+ """
733
+ 获取任务结果,等待任务结束
734
+ :param cookie:
735
+ :param batch_id:
736
+ :return:
737
+ """
738
+ while True:
739
+ res = get_task_result(
740
+ cookie=cookie,
741
+ batch_id=batch_id
742
+ )
743
+ if res.get("code") == 0:
744
+ processing = res["data"]["processing"]
745
+ if not processing:
746
+ return res
747
+ else:
748
+ lazytime.count_down(1)
749
+ else:
750
+ return res
751
+
752
+
753
+ def get_project_report(
754
+ cookie: str,
755
+ media_type: str = "aggregate",
756
+ start_date: str = None,
757
+ end_date: str = None,
758
+ page: int = 1,
759
+ page_size: int = 20,
760
+ sort_field: str = "aggregate_cost",
761
+ sort_direction: str = "desc",
762
+ data_type: str = "list",
763
+ conditions: dict = None,
764
+ kpis: list = None,
765
+ relate_dims: list = None,
766
+ time_line: str = "REPORTING_TIME",
767
+ time_dim: str = "days",
768
+ data_dim: str = "media_project_id"
769
+ ):
770
+ """
771
+ 报表-项目报表
772
+ :param cookie:
773
+ :param media_type: 媒体:aggregate|不限
774
+ :param start_date: 数据开始日期,默认为当日
775
+ :param end_date: 数据结束日期,默认为当日
776
+ :param page: 页码
777
+ :param page_size: 每页数量
778
+ :param sort_field: 排序字段
779
+ :param sort_direction: 排序方式,desc降序
780
+ :param data_type:
781
+ :param conditions: 搜索条件
782
+ :param kpis: 需要获取的字段
783
+ :param relate_dims:
784
+ :param time_line:
785
+ :param time_dim:
786
+ :param data_dim:
787
+ :return:
788
+ """
789
+ if not start_date:
790
+ start_date = lazytime.get_date_string(days=0)
791
+ if not end_date:
792
+ end_date = lazytime.get_date_string(days=0)
793
+ url = "https://cli2.mobgi.com/ReportV23/ProjectReport/getReport"
794
+ data = {
795
+ "time_dim": time_dim,
796
+ "media_type": media_type,
797
+ "data_type": data_type,
798
+ "data_dim": data_dim,
799
+ "sort_field": sort_field,
800
+ "sort_direction": sort_direction,
801
+ "start_date": start_date,
802
+ "end_date": end_date,
803
+ "page": page,
804
+ "page_size": page_size
805
+ }
806
+
807
+ if not conditions:
808
+ conditions = {
809
+ "media_project_id": [],
810
+ "advertiser_id": [],
811
+ "media_type": "",
812
+ "project_id": [],
813
+ "owner_user_id": [],
814
+ "media_agent_id": [],
815
+ "time_line": time_line
816
+ }
817
+ if not kpis:
818
+ kpis = [
819
+ "aggregate_cost"
820
+ ]
821
+ if not relate_dims:
822
+ relate_dims = [
823
+ "owner_user_id",
824
+ "media_type"
825
+ ]
826
+
827
+ headers = copy.deepcopy(default_headers)
828
+ headers["Cookie"] = cookie
829
+ data["conditions"] = conditions
830
+ data["kpis"] = kpis
831
+ data["relate_dims"] = relate_dims
832
+ return lazyrequests.lazy_requests(
833
+ method="POST",
834
+ url=url,
835
+ json=data,
836
+ headers=headers
837
+ )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: lazyad
3
- Version: 0.0.34
3
+ Version: 0.0.36
4
4
  Summary: 基于Python的懒人包-适用于广告投放模块
5
5
  Home-page: https://gitee.com/ZeroSeeker/lazyad
6
6
  Author: ZeroSeeker
@@ -13,7 +13,7 @@ with open("README.md", "r", encoding='utf-8') as fh:
13
13
 
14
14
  setuptools.setup(
15
15
  name="lazyad",
16
- version="0.0.34",
16
+ version="0.0.36",
17
17
  description="基于Python的懒人包-适用于广告投放模块",
18
18
  long_description=long_description,
19
19
  long_description_content_type="text/markdown",
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes