0001-portfolio-remove-unused-functions-39921.patch
wcs/portfolio.py | ||
---|---|---|
46 | 46 |
return sign_url(url, secret) |
47 | 47 | |
48 | 48 | |
49 |
def fargo_get(url): |
|
50 |
url = fargo_url(url) |
|
51 |
response, status, data, auth_header = http_get_page(url) |
|
52 |
if status == 200: |
|
53 |
return json_loads(data) |
|
54 |
return {'err': 1} |
|
55 | ||
56 | ||
57 |
def fargo_post_json(url, payload): |
|
58 |
url = fargo_url(url) |
|
59 |
headers = {'Content-Type': 'application/json'} |
|
60 |
response, status, response_payload, auth_header = http_post_request( |
|
61 |
url, json.dumps(payload), headers=headers) |
|
62 |
return status, json_loads(response_payload) |
|
63 | ||
64 | ||
65 | 49 |
# Allow doing a signed POST in an afterjob, as fargo_url() does not work if no request is in |
66 | 50 |
# context; so we do it in the constructor. |
67 | 51 |
class fargo_post_json_async(object): |
... | ... | |
76 | 60 |
return status, json_loads(response_payload) |
77 | 61 | |
78 | 62 | |
79 |
def sha256_of_upload(upload): |
|
80 |
return hashlib.sha256(upload.get_content()).hexdigest() |
|
81 | ||
82 | ||
83 | 63 |
def push_document(user, filename, stream): |
84 | 64 |
if not user: |
85 | 65 |
return |
86 |
- |