libmozdata 0.2.14__tar.gz → 0.2.16__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.
- {libmozdata-0.2.14/libmozdata.egg-info → libmozdata-0.2.16}/PKG-INFO +1 -1
- libmozdata-0.2.16/VERSION +1 -0
- {libmozdata-0.2.14 → libmozdata-0.2.16}/libmozdata/fx_trains.py +12 -0
- {libmozdata-0.2.14 → libmozdata-0.2.16}/libmozdata/lando.py +5 -6
- {libmozdata-0.2.14 → libmozdata-0.2.16}/libmozdata/phabricator.py +7 -27
- {libmozdata-0.2.14 → libmozdata-0.2.16}/libmozdata/utils.py +44 -0
- {libmozdata-0.2.14 → libmozdata-0.2.16/libmozdata.egg-info}/PKG-INFO +1 -1
- {libmozdata-0.2.14 → libmozdata-0.2.16}/libmozdata.egg-info/requires.txt +2 -1
- {libmozdata-0.2.14 → libmozdata-0.2.16}/requirements.txt +2 -1
- libmozdata-0.2.14/VERSION +0 -1
- {libmozdata-0.2.14 → libmozdata-0.2.16}/MANIFEST.in +0 -0
- {libmozdata-0.2.14 → libmozdata-0.2.16}/README.md +0 -0
- {libmozdata-0.2.14 → libmozdata-0.2.16}/libmozdata/BZInfo.py +0 -0
- {libmozdata-0.2.14 → libmozdata-0.2.16}/libmozdata/FXRevision.py +0 -0
- {libmozdata-0.2.14 → libmozdata-0.2.16}/libmozdata/FileStats.py +0 -0
- {libmozdata-0.2.14 → libmozdata-0.2.16}/libmozdata/HGFileInfo.py +0 -0
- {libmozdata-0.2.14 → libmozdata-0.2.16}/libmozdata/__init__.py +0 -0
- {libmozdata-0.2.14 → libmozdata-0.2.16}/libmozdata/bugzilla.py +0 -0
- {libmozdata-0.2.14 → libmozdata-0.2.16}/libmozdata/buildhub.py +0 -0
- {libmozdata-0.2.14 → libmozdata-0.2.16}/libmozdata/clouseau.py +0 -0
- {libmozdata-0.2.14 → libmozdata-0.2.16}/libmozdata/config.py +0 -0
- {libmozdata-0.2.14 → libmozdata-0.2.16}/libmozdata/connection.py +0 -0
- {libmozdata-0.2.14 → libmozdata-0.2.16}/libmozdata/handler.py +0 -0
- {libmozdata-0.2.14 → libmozdata-0.2.16}/libmozdata/hgmozilla.py +0 -0
- {libmozdata-0.2.14 → libmozdata-0.2.16}/libmozdata/modules.json +0 -0
- {libmozdata-0.2.14 → libmozdata-0.2.16}/libmozdata/modules.py +0 -0
- {libmozdata-0.2.14 → libmozdata-0.2.16}/libmozdata/patchanalysis.py +0 -0
- {libmozdata-0.2.14 → libmozdata-0.2.16}/libmozdata/redash.py +0 -0
- {libmozdata-0.2.14 → libmozdata-0.2.16}/libmozdata/socorro.py +0 -0
- {libmozdata-0.2.14 → libmozdata-0.2.16}/libmozdata/vcs_map.py +0 -0
- {libmozdata-0.2.14 → libmozdata-0.2.16}/libmozdata/versions.py +0 -0
- {libmozdata-0.2.14 → libmozdata-0.2.16}/libmozdata/wiki_parser.py +0 -0
- {libmozdata-0.2.14 → libmozdata-0.2.16}/libmozdata.egg-info/SOURCES.txt +0 -0
- {libmozdata-0.2.14 → libmozdata-0.2.16}/libmozdata.egg-info/dependency_links.txt +0 -0
- {libmozdata-0.2.14 → libmozdata-0.2.16}/libmozdata.egg-info/not-zip-safe +0 -0
- {libmozdata-0.2.14 → libmozdata-0.2.16}/libmozdata.egg-info/top_level.txt +0 -0
- {libmozdata-0.2.14 → libmozdata-0.2.16}/setup.cfg +0 -0
- {libmozdata-0.2.14 → libmozdata-0.2.16}/setup.py +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
0.2.16
|
|
@@ -88,4 +88,16 @@ class FirefoxTrains:
|
|
|
88
88
|
api_path = "firefox/releases/"
|
|
89
89
|
return self.__get(api_path)
|
|
90
90
|
|
|
91
|
+
def get_lando_uplift_train(self):
|
|
92
|
+
"""Get the current version and release date for each channel.
|
|
93
|
+
|
|
94
|
+
Returns:
|
|
95
|
+
dict: keyed by channel (nightly, beta, release, esr, esr_previous),
|
|
96
|
+
each value a dict with at least a "version" (int) key. A channel
|
|
97
|
+
may be null (e.g. esr_previous outside an ESR overlap period).
|
|
98
|
+
"""
|
|
99
|
+
|
|
100
|
+
api_path = "lando/uplift/train/"
|
|
101
|
+
return self.__get(api_path)
|
|
102
|
+
|
|
91
103
|
# TODO: add methods for the other API endpoints
|
|
@@ -6,9 +6,8 @@
|
|
|
6
6
|
from collections import namedtuple
|
|
7
7
|
from urllib.parse import urljoin
|
|
8
8
|
|
|
9
|
-
import requests
|
|
10
|
-
|
|
11
9
|
from . import config
|
|
10
|
+
from .utils import get_session
|
|
12
11
|
|
|
13
12
|
|
|
14
13
|
class LandoWarnings(object):
|
|
@@ -28,7 +27,7 @@ class LandoWarnings(object):
|
|
|
28
27
|
for warning in warnings:
|
|
29
28
|
warning_id = warning["id"]
|
|
30
29
|
|
|
31
|
-
response =
|
|
30
|
+
response = get_session("lando").delete(
|
|
32
31
|
f"{self.api_url}{warning_id}",
|
|
33
32
|
headers={
|
|
34
33
|
"X-Phabricator-API-Key": self.api_key,
|
|
@@ -45,7 +44,7 @@ class LandoWarnings(object):
|
|
|
45
44
|
"""
|
|
46
45
|
Adds a warning to Lando
|
|
47
46
|
"""
|
|
48
|
-
response =
|
|
47
|
+
response = get_session("lando").post(
|
|
49
48
|
self.api_url,
|
|
50
49
|
json={
|
|
51
50
|
"revision_id": revision_id,
|
|
@@ -67,7 +66,7 @@ class LandoWarnings(object):
|
|
|
67
66
|
"""
|
|
68
67
|
Gets a list of warnings
|
|
69
68
|
"""
|
|
70
|
-
response =
|
|
69
|
+
response = get_session("lando").get(
|
|
71
70
|
self.api_url,
|
|
72
71
|
params={
|
|
73
72
|
"revision_id": revision_id,
|
|
@@ -122,7 +121,7 @@ class LandoCommitMapAPI:
|
|
|
122
121
|
with both full hashes
|
|
123
122
|
"""
|
|
124
123
|
url = urljoin(self.api_url, f"{method}/{repository}/{revision}")
|
|
125
|
-
resp =
|
|
124
|
+
resp = get_session("lando").get(
|
|
126
125
|
url,
|
|
127
126
|
headers={
|
|
128
127
|
"User-Agent": self.USER_AGENT,
|
|
@@ -7,15 +7,13 @@ import collections
|
|
|
7
7
|
import enum
|
|
8
8
|
import json
|
|
9
9
|
import logging
|
|
10
|
-
import math
|
|
11
|
-
import time
|
|
12
10
|
from functools import cached_property
|
|
13
11
|
from urllib.parse import urlencode, urlparse
|
|
14
12
|
|
|
15
13
|
import hglib
|
|
16
|
-
import requests
|
|
17
14
|
|
|
18
15
|
from . import config
|
|
16
|
+
from .utils import get_session
|
|
19
17
|
|
|
20
18
|
HGMO_JSON_REV_URL_TEMPLATE = "https://hg.mozilla.org/mozilla-central/json-rev/{}"
|
|
21
19
|
MOZILLA_PHABRICATOR_PROD = "https://phabricator.services.mozilla.com/api/"
|
|
@@ -210,18 +208,12 @@ class PhabricatorAPI(object):
|
|
|
210
208
|
Phabricator Rest API client
|
|
211
209
|
"""
|
|
212
210
|
|
|
213
|
-
def __init__(self, api_key, url=MOZILLA_PHABRICATOR_PROD
|
|
211
|
+
def __init__(self, api_key, url=MOZILLA_PHABRICATOR_PROD):
|
|
214
212
|
self.USER_AGENT = config.get("User-Agent", "name", required=True)
|
|
215
213
|
self.api_key = api_key
|
|
216
214
|
self.url = url
|
|
217
215
|
assert self.url.endswith("/api/"), "Phabricator API must end with /api/"
|
|
218
216
|
|
|
219
|
-
# Number of API calls retries on 50x before raising an error
|
|
220
|
-
self.max_retries = max_retries
|
|
221
|
-
assert (
|
|
222
|
-
isinstance(self.max_retries, int) and self.max_retries > 0
|
|
223
|
-
), "Invalid max_retries parameter"
|
|
224
|
-
|
|
225
217
|
@cached_property
|
|
226
218
|
def user(self):
|
|
227
219
|
"""
|
|
@@ -669,23 +661,11 @@ class PhabricatorAPI(object):
|
|
|
669
661
|
# Add api token to payload
|
|
670
662
|
payload["__conduit__"] = {"token": self.api_key}
|
|
671
663
|
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
data=urlencode({"params": json.dumps(payload), "output": "json"}),
|
|
678
|
-
)
|
|
679
|
-
if response.status_code >= 500:
|
|
680
|
-
# Retry after a while on 50x using exponential backoff
|
|
681
|
-
backoff = math.exp(nb_try)
|
|
682
|
-
logger.info(
|
|
683
|
-
f"Phabricator failed with status code {response.status_code}, retrying in {backoff:.1f} seconds..."
|
|
684
|
-
)
|
|
685
|
-
time.sleep(backoff)
|
|
686
|
-
else:
|
|
687
|
-
# Stop retrying on the first successful try or other HTTP errors
|
|
688
|
-
break
|
|
664
|
+
response = get_session("phabricator").post(
|
|
665
|
+
self.url + path,
|
|
666
|
+
headers=self.get_header(),
|
|
667
|
+
data=urlencode({"params": json.dumps(payload), "output": "json"}),
|
|
668
|
+
)
|
|
689
669
|
|
|
690
670
|
# Raise immediate 40x errors or out-of-retries 50x
|
|
691
671
|
response.raise_for_status()
|
|
@@ -8,17 +8,61 @@ import operator
|
|
|
8
8
|
import os.path
|
|
9
9
|
import random
|
|
10
10
|
from datetime import date, datetime, timedelta, timezone
|
|
11
|
+
from functools import cache
|
|
11
12
|
from itertools import count
|
|
12
13
|
|
|
13
14
|
import dateutil.parser
|
|
14
15
|
import pytz
|
|
16
|
+
import requests
|
|
15
17
|
import six
|
|
16
18
|
from dateutil.relativedelta import relativedelta
|
|
17
19
|
from requests.utils import quote
|
|
20
|
+
from urllib3.util.retry import Retry
|
|
18
21
|
|
|
19
22
|
__pacific = pytz.timezone("US/Pacific")
|
|
20
23
|
|
|
21
24
|
|
|
25
|
+
@cache
|
|
26
|
+
def get_session(name: str) -> requests.Session:
|
|
27
|
+
"""Get a `requests` session with retries enabled on connection errors and
|
|
28
|
+
50x HTTP error codes, using exponential backoff.
|
|
29
|
+
|
|
30
|
+
Sessions are cached by name, so calling this function multiple times with
|
|
31
|
+
the same name will return the same session.
|
|
32
|
+
|
|
33
|
+
Args:
|
|
34
|
+
name (str): an arbitrary name identifying the caller, used to cache
|
|
35
|
+
the session
|
|
36
|
+
|
|
37
|
+
Returns:
|
|
38
|
+
requests.Session: a session with retries enabled
|
|
39
|
+
"""
|
|
40
|
+
session = requests.Session()
|
|
41
|
+
|
|
42
|
+
retry = Retry(
|
|
43
|
+
total=8,
|
|
44
|
+
backoff_factor=1,
|
|
45
|
+
status_forcelist=[429, 500, 502, 503, 504],
|
|
46
|
+
# Also retry non-idempotent methods (e.g. POST), since urllib3
|
|
47
|
+
# excludes them by default.
|
|
48
|
+
allowed_methods=None,
|
|
49
|
+
# Return the last response instead of raising, once retries are
|
|
50
|
+
# exhausted, so callers can keep inspecting status_code/text.
|
|
51
|
+
raise_on_status=False,
|
|
52
|
+
)
|
|
53
|
+
|
|
54
|
+
# Default HTTPAdapter uses 10 connections. Mount custom adapter to increase
|
|
55
|
+
# that limit. Connections are established as needed, so using a large value
|
|
56
|
+
# should not negatively impact performance.
|
|
57
|
+
http_adapter = requests.adapters.HTTPAdapter(
|
|
58
|
+
pool_connections=50, pool_maxsize=50, max_retries=retry
|
|
59
|
+
)
|
|
60
|
+
session.mount("https://", http_adapter)
|
|
61
|
+
session.mount("http://", http_adapter)
|
|
62
|
+
|
|
63
|
+
return session
|
|
64
|
+
|
|
65
|
+
|
|
22
66
|
def get_best(stats):
|
|
23
67
|
"""Get the key which has the higher value
|
|
24
68
|
|
libmozdata-0.2.14/VERSION
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
0.2.14
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|