Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
@decorators.fn(gpi_image=GPI_IMAGE, dependencies={
"requests_get": requests.get
})
def request(self, *args, **kwargs) -> dict:
requests_get = kwargs["dependencies"].get("requests_get")
r = requests_get('https://api.github.com/events')
r.raise_for_status()
return r.content
@decorators.fn(gpi_image=GPI_IMAGE)
def dummy(*args, **kwargs) -> str:
return ""
@decorators.with_type_cast(
return_type=lambda x: ujson.loads(x))
@decorators.fn(gpi_image=GPI_IMAGE, dependencies={
"requests_get": requests.get
})
def request(self, *args, **kwargs) -> dict:
requests_get = kwargs["dependencies"].get("requests_get")
r = requests_get('https://api.github.com/events')
r.raise_for_status()
return r.content
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
import requests
import ujson
from fdk.application import decorators
GPI_IMAGE = "denismakogon/python3-fn-gpi:0.0.6"
@decorators.fn_app
class Application(object):
def __init__(self, *args, **kwargs):
pass
@decorators.fn(gpi_image=GPI_IMAGE)
def dummy(*args, **kwargs) -> str:
return ""
@decorators.fn(gpi_image=GPI_IMAGE)
def square(self, x: int, y: int, *args, **kwargs) -> bytes:
return x * y
@decorators.with_type_cast(
return_type=lambda x: {"power": x})
@decorators.fn(gpi_image=GPI_IMAGE)