github-backup 0.50.2__py3-none-any.whl → 0.50.3__py3-none-any.whl

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.
github_backup/__init__.py CHANGED
@@ -1 +1 @@
1
- __version__ = "0.50.2"
1
+ __version__ = "0.50.3"
@@ -578,10 +578,15 @@ def retrieve_data_gen(args, template, query_args=None, single_request=False):
578
578
  page = 0
579
579
 
580
580
  while True:
581
- page = page + 1
581
+ if single_request:
582
+ request_page, request_per_page = None, None
583
+ else:
584
+ page = page + 1
585
+ request_page, request_per_page = page, per_page
586
+
582
587
  request = _construct_request(
583
- per_page,
584
- page,
588
+ request_per_page,
589
+ request_page,
585
590
  query_args,
586
591
  template,
587
592
  auth,
@@ -715,14 +720,22 @@ def _get_response(request, auth, template):
715
720
  def _construct_request(
716
721
  per_page, page, query_args, template, auth, as_app=None, fine=False
717
722
  ):
718
- querystring = urlencode(
719
- dict(
720
- list({"per_page": per_page, "page": page}.items())
721
- + list(query_args.items())
722
- )
723
- )
723
+ all_query_args = {}
724
+ if per_page:
725
+ all_query_args["per_page"] = per_page
726
+ if page:
727
+ all_query_args["page"] = page
728
+ if query_args:
729
+ all_query_args.update(query_args)
730
+
731
+ request_url = template
732
+ if all_query_args:
733
+ querystring = urlencode(all_query_args)
734
+ request_url = template + "?" + querystring
735
+ else:
736
+ querystring = ""
724
737
 
725
- request = Request(template + "?" + querystring)
738
+ request = Request(request_url)
726
739
  if auth is not None:
727
740
  if not as_app:
728
741
  if fine:
@@ -735,7 +748,11 @@ def _construct_request(
735
748
  request.add_header(
736
749
  "Accept", "application/vnd.github.machine-man-preview+json"
737
750
  )
738
- logger.info("Requesting {}?{}".format(template, querystring))
751
+
752
+ log_url = template
753
+ if querystring:
754
+ log_url += "?" + querystring
755
+ logger.info("Requesting {}".format(log_url))
739
756
  return request
740
757
 
741
758
 
@@ -885,9 +902,13 @@ def retrieve_repositories(args, authenticated_user):
885
902
  )
886
903
 
887
904
  if args.repository:
905
+ if "/" in args.repository:
906
+ repo_path = args.repository
907
+ else:
908
+ repo_path = "{0}/{1}".format(args.user, args.repository)
888
909
  single_request = True
889
- template = "https://{0}/repos/{1}/{2}".format(
890
- get_github_api_host(args), args.user, args.repository
910
+ template = "https://{0}/repos/{1}".format(
911
+ get_github_api_host(args), repo_path
891
912
  )
892
913
 
893
914
  repos = retrieve_data(args, template, single_request=single_request)
@@ -928,6 +949,8 @@ def retrieve_repositories(args, authenticated_user):
928
949
 
929
950
 
930
951
  def filter_repositories(args, unfiltered_repositories):
952
+ if args.repository:
953
+ return unfiltered_repositories
931
954
  logger.info("Filtering repositories")
932
955
 
933
956
  repositories = []
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: github-backup
3
- Version: 0.50.2
3
+ Version: 0.50.3
4
4
  Summary: backup a github user or organization
5
5
  Home-page: http://github.com/josegonzalez/python-github-backup
6
6
  Author: Jose Diaz-Gonzalez
@@ -0,0 +1,9 @@
1
+ github_backup/__init__.py,sha256=uG9Fg41SFOkUm9XwkxGLSN_5MUansanjnAPwUcghDGU,23
2
+ github_backup/github_backup.py,sha256=tc6yz1r_KjIl2BQden_dVD7SCy5oi1bJdYak7K9sqnY,50494
3
+ github_backup-0.50.3.data/scripts/github-backup,sha256=I79TNA67phytRmI9nm_LlD9h2zauXFOsOn9tYyAy9pU,1546
4
+ github_backup-0.50.3.dist-info/licenses/LICENSE.txt,sha256=ML-pLyn1qtAKo_DHMcQ8-p7k3f8cp-IR-mf5B49R2rk,1085
5
+ github_backup-0.50.3.dist-info/METADATA,sha256=B_Za11wHbQCHSXXXw6xaubC1CmGMB4wd9QXuEEL8ago,19402
6
+ github_backup-0.50.3.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
7
+ github_backup-0.50.3.dist-info/top_level.txt,sha256=Za6fKRAlxZ0b3ZBH_osPqklLe14LetdNAkvAQANT2AA,14
8
+ github_backup-0.50.3.dist-info/zip-safe,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
9
+ github_backup-0.50.3.dist-info/RECORD,,
@@ -1,9 +0,0 @@
1
- github_backup/__init__.py,sha256=wGAaVepT9NGUHa2UImMJqVwxYz7S7aIYbR1KZt9OLHo,23
2
- github_backup/github_backup.py,sha256=zdd7nk2y2lGXcdLRvfChWSAf1qWVcLH3qZexCnPwpeI,49846
3
- github_backup-0.50.2.data/scripts/github-backup,sha256=I79TNA67phytRmI9nm_LlD9h2zauXFOsOn9tYyAy9pU,1546
4
- github_backup-0.50.2.dist-info/licenses/LICENSE.txt,sha256=ML-pLyn1qtAKo_DHMcQ8-p7k3f8cp-IR-mf5B49R2rk,1085
5
- github_backup-0.50.2.dist-info/METADATA,sha256=nm98RKSZu_yzKVpgKYkkdeveH8hcDwg1UHwHrm2a8lg,19402
6
- github_backup-0.50.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
7
- github_backup-0.50.2.dist-info/top_level.txt,sha256=Za6fKRAlxZ0b3ZBH_osPqklLe14LetdNAkvAQANT2AA,14
8
- github_backup-0.50.2.dist-info/zip-safe,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
9
- github_backup-0.50.2.dist-info/RECORD,,