Uh oh!
There was an error while loading. Please reload this page.
Add generate_upload_policy - #2998
Conversation
| for key, value in policy.items() | ||
| ) | ||
| upload_form = ( |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
| from google.cloud._helpers import _rfc3339_to_datetime | ||
| from google.cloud._helpers import ( | ||
| _NOW, _rfc3339_to_datetime, _datetime_to_rfc3339) |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
| :type expiration: datetime | ||
| :param expiration: Optional expiration in UTC. If not specified, the | ||
| policy will expire in 1 hour. |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
| if not isinstance(credentials, google.auth.credentials.Signing): | ||
| auth_uri = ('http://google-cloud-python.readthedocs.io/en/latest/' | ||
| 'google-cloud-auth.html#setting-up-a-service-account') |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
| conditions = conditions + [ | ||
| {'bucket': self.name} | ||
| ] |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
| policy_document = { | ||
| 'expiration': _datetime_to_rfc3339(expiration), | ||
| 'conditions': conditions |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
| encoded_policy_document = base64.b64encode( | ||
| json.dumps(policy_document).encode('utf-8')) | ||
| signature = base64.b64encode( | ||
| credentials.sign_bytes(encoded_policy_document)) |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
| 'bucket': self.name, | ||
| 'GoogleAccessId': credentials.signer_email, | ||
| 'policy': encoded_policy_document.decode('utf-8'), | ||
| 'signature': signature.decode('utf-8') |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
| bucket = self._make_one(client=client, name=name) | ||
| conditions = [ | ||
| ['starts-with', '$key', '']] |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
| import json | ||
| credentials = _create_signing_credentials() | ||
| credentials.signer_email = mock.sentinel.signer_email |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
theacodes
commented
Feb 11, 2017
(Travis is finally green) |
| for key, value in policy.items() | ||
| ) | ||
| upload_form = ( |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
| `policy documents`_ documentation. | ||
| :type client: :class:`~google.cloud.storage.client.Client` or | ||
| `NoneType`` |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
| :rtype: dict | ||
| :returns: A dictionary of (form field name, form field value) of form | ||
| fields that should be added to your HTML upload form in order | ||
| to attach the signature. |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
| if not isinstance(credentials, google.auth.credentials.Signing): | ||
| auth_uri = ('http://google-cloud-python.readthedocs.io/en/latest/' | ||
| 'google-cloud-auth.html#setting-up-a-service-account') |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
| encoded_policy_document = base64.b64encode( | ||
| json.dumps(policy_document).encode('utf-8')) | ||
| signature = base64.b64encode( | ||
| credentials.sign_bytes(encoded_policy_document)) |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
theacodes
commented
Feb 16, 2017
@dhermes LGTY? |
dhermes
commented
Feb 16, 2017
Yup. But CircleCI is failing? |
dhermes
commented
Feb 16, 2017
CircleCI is failing because you haven't rebased on master since #3002 |
4c5d439 to
1327323Comparetheacodes
commented
Feb 16, 2017
@dhermes good eye, rebased. Will merge once all is green. |
Resolves#2861