Get some python in google cloud functions

Overview

PyPI version

[NOTE]: This is a highly experimental (and proof of concept) library so do not expect all python packages to work flawlessly. Also, cloud functions are now (Summer 2018) rolling out native support for python3 in EAP so that also might be an option, check out the #functions channel on googlecloud-community.slack.com where the product managers hang around and open to help you out!

cloud-functions-python

py-cloud-fn is a CLI tool that allows you to write and deploy Google cloud functions in pure python, supporting python 2.7 and 3.5 (thanks to @MitalAshok for helping on the code compatibility). No javascript allowed! The goal of this library is to be able to let developers write light weight functions in idiomatic python without needing to worry about node.js. It works OOTB with pip, just include a file named requirements.txt that is structured like this:

pycloudfn==0.1.206
jsonpickle==0.9.4

as you normally would when building any python application. When building (for production), the library will pick up this file and make sure to install the dependencies. It will do so while caching all dependencies in a virtual environment, to speed up subsequent builds.

TLDR, look at the examples

Run pip install pycloudfn to get it. You need to have Google cloud SDK installed, as well as the Cloud functions emulator and npm if you want to test your function locally.

You also need Docker installed and running as well as the gcloud CLI. Docker is needed to build for the production environment, regardless of you local development environment.

Currently, http, pubsub and bucket events are supported (no firebase).

Usage

CLI

usage: py-cloud-fn [-h] [-p] [-f FILE_NAME] [--python_version {2.7,3.5,3.6}]
                   function_name {http,pubsub,bucket}

Build a GCP Cloud Function in python.

positional arguments:
  function_name         the name of your cloud function
  {http,pubsub,bucket}  the trigger type of your cloud function

optional arguments:
  -h, --help            show this help message and exit
  -p, --production      Build function for production environment
  -i, --production_image
                        Docker image to use for building production environment
  -f FILE_NAME, --file_name FILE_NAME
                        The file name of the file you wish to build
  --python_version {2.7,3.5}
                        The python version you are targeting, only applies
                        when building for production

Usage is meant to be pretty idiomatic:

Run py-cloud-fn <function_name> <trigger_type> to build your finished function. Run with -h to get some guidance on options. The library will assume that you have a file named main.py if not specified.

The library will create a cloudfn folder wherever it is used, which can safely be put in .gitignore. It contains build files and cache for python packages.

$DJANGO_SETTINGS_MODULE=mysite.settings py-cloud-fn my-function http -f function.py --python_version 3.5

  _____                  _                 _         __
 |  __ \                | |               | |       / _|
 | |__) |   _ ______ ___| | ___  _   _  __| |______| |_ _ __
 |  ___/ | | |______/ __| |/ _ \| | | |/ _` |______|  _| '_ \
 | |   | |_| |     | (__| | (_) | |_| | (_| |      | | | | | |
 |_|    \__, |      \___|_|\___/ \__,_|\__,_|      |_| |_| |_|
         __/ |
        |___/

Function: my-function
File: function.py
Trigger: http
Python version: 3.5
Production: False

⠴    Building, go grab a coffee...
⠋    Generating javascript...
⠼    Cleaning up...

Elapsed time: 37.6s
Output: ./cloudfn/target/index.js

Dependencies

This library works with pip OOTB. Just add your requirements.txt file in the root of the repo and you are golden. It obviously needs pycloudfn to be present.

Authentication

Since this is not really supported by google, there is one thing that needs to be done to make this work smoothly: You can't use the default clients directly. It's solvable though, just do

from cloudfn.google_account import get_credentials

biquery_client = bigquery.Client(credentials=get_credentials())

And everything is taken care off for you!! no more actions need be done.

Handling a http request

Look at the Request object for the structure

from cloudfn.http import handle_http_event, Response


def handle_http(req):
      return Response(
        status_code=200,
        body={'key': 2},
        headers={'content-type': 'application/json'},
    )


handle_http_event(handle_http)

If you don't return anything, or return something different than a cloudfn.http.Response object, the function will return a 200 OK with an empty body. The body can be either a string, list or dictionary, other values will be forced to a string.

Handling http with Flask

Flask is a great framework for building microservices. The library supports flask OOTB. If you need to have some routing / parsing and verification logic in place, flask might be a good fit! Have a look at the example to see how easy it is!

from cloudfn.flask_handler import handle_http_event
from cloudfn.google_account import get_credentials
from flask import Flask, request
from flask.json import jsonify
from google.cloud import bigquery

app = Flask('the-function')
biquery_client = bigquery.Client(credentials=get_credentials())


@app.route('/',  methods=['POST', 'GET'])
def hello():
    print request.headers
    return jsonify(message='Hello world!', json=request.get_json()), 201


@app.route('/lol')
def helloLol():
    return 'Hello lol!'


@app.route('/bigquery-datasets',  methods=['POST', 'GET'])
def bigquery():
    datasets = []
    for dataset in biquery_client.list_datasets():
        datasets.append(dataset.name)
    return jsonify(message='Hello world!', datasets={
        'datasets': datasets
    }), 201


handle_http_event(app)

Handling http with Django

Django is a great framework for building microservices. The library supports django OOTB. Assuming you have setup your django application in a normal fashion, this should be what you need. You need to setup a pretty minimal django application (no database etc) to get it working. It might be a little overkill to squeeze django into a cloud function, but there are some pretty nice features for doing request verification and routing in django using for intance django rest framework.

See the example for how you can handle a http request using django.

from cloudfn.django_handler import handle_http_event
from mysite.wsgi import application


handle_http_event(application)

Handling a bucket event

look at the Object for the structure, it follows the convention in the Storage API

from cloudfn.storage import handle_bucket_event
import jsonpickle


def bucket_handler(obj):
    print jsonpickle.encode(obj)


handle_bucket_event(bucket_handler)

Handling a pubsub message

Look at the Message for the structure, it follows the convention in the Pubsub API

from cloudfn.pubsub import handle_pubsub_event
import jsonpickle


def pubsub_handler(message):
    print jsonpickle.encode(message)


handle_pubsub_event(pubsub_handler)

Deploying a function

I have previously built go-cloud-fn, in which there is a complete CLI available for you to deploy a function. I did not want to go there now, but rather be concerned about building the function and be super light weight. Deploying a function can be done like this:

(If you have the emulator installed, just swap gcloud beta functions with npm install && functions and you are golden!).

HTTP

py-cloud-fn my-function http --production && \
cd cloudfn/target && gcloud beta functions deploy my-function \
--trigger-http --stage-bucket <bucket> && cd ../..

Storage

py-cloud-fn  my-bucket-function bucket -p && cd cloudfn/target && \
gcloud beta functions deploy my-bucket-function --trigger-bucket \
<trigger-bucket> --stage-bucket <stage-bucket> && cd ../..

Pubsub

py-cloud-fn my-topic-function bucket -p && cd cloudfn/target && \
gcloud beta functions deploy my-topic-function --trigger-topic <topic> \
--stage-bucket <bucket> && cd ../..

Adding support for packages that do not work

  • Look at the build output for what might be wrong.
  • Look for what modules might be missing.
  • Add a line-delimited file for hidden imports and a folder called cloudfn-hooks in the root of your repo, see more at Pyinstaller for how it works. Check out this for how to add hooks.

Troubleshooting

When things blow up, the first thing to try is to delete the cloudfn cache folder. Things might go a bit haywire when builds are interrupted or other circumstances. It just might save the day! Please get in touch at twitter if you bump into anything: @MartinSahlen

License

Copyright © 2017 Martin Sahlen

Distributed under the MIT License

Comments
  • New to this, need some help!

    New to this, need some help!

    I followed all the steps to setup all the requirements for this cloud-function-python

    I have a python file that I would like to execute. I have all the virtual environment libraries those are required in a requirements.txt file.

    Can anyone guide me what should I do to execute the python file?

    opened by santhoshdc1590 15
  • CORS (Cross-origin resource sharing) not supported by cloud-function-python

    CORS (Cross-origin resource sharing) not supported by cloud-function-python

    On POSTMAN the cloud function is working as expected.

    Only when the cloud function URL is called from a browser I'm getting this error in the logs.

    Traceback (most recent call last): File "function.py", line 29, in File "site-packages/cloudfn/http.py", line 45, in handle_http_event File "site-packages/cloudfn/http.py", line 12, in init KeyError: 'body'

    This is my function.py file content

    from FTUL import mainP
    from cloudfn.google_account import get_credentials
    from cloudfn.http import handle_http_event, Response
    from google.cloud import bigquery
    import json
    
    
    def handle_http(req):
        
        biquery_client = bigquery.Client(credentials=get_credentials())
        
        console.log(req)
        console.log(req.method)
        console.log(req.body)
    
        if req.method == 'OPTIONS':
            return Response(
                status_code=200,
            )
        
        if req.method == 'POST':
            
            rBody = json.loads(req.body)
            im = rBody['image']
            rID = rBody['refID']
            rTable = rBody['refTable']
            uAlgo = 0
            empID = rBody['empID']
            val = mainP(im,rID,rTable,uAlgo,empID)
    
            return Response(
                status_code=200,
            )
    
    
    handle_http_event(handle_http)
    

    On the browser logs the error is being shown as a 500 error in the 'OPTIONS'

    Browser is sending a req.method as OPTIONS but we have no body present in this req but function is expecting a body inside req.method.

    What's the work around for this?

    opened by santhoshdc1590 13
  • google-api-core was not found on production

    google-api-core was not found on production

    I got following error when I accessed to the end point of flask handler.

    2017-11-05T08:30:31.471Z - error:     exec(bytecode, module.__dict__)
      File "site-packages/google/cloud/storage/__init__.py", line 39, in <module>
      File "/Users/seijik/.pyenv/versions/venv27/lib/python2.7/site-packages/PyInstaller/loader/pyimod03_importers.py", line 389, in load_module
        exec(bytecode, module.__dict__)
      File "site-packages/google/cloud/storage/bucket.py", line 24, in <module>
      File "/Users/seijik/.pyenv/versions/venv27/lib/python2.7/site-packages/PyInstaller/loader/pyimod03_importers.py", line 389, in load_module
        exec(bytecode, module.__dict__)
      File "site-packages/google/api_core/__init__.py", line 23, in <module>
      File "site-packages/pkg_resources/__init__.py", line 562, in get_distribution
      File "site-packages/pkg_resources/__init__.py", line 436, in get_provider
      File "site-packages/pkg_resources/__init__.py", line 981, in require
      File "site-packages/pkg_resources/__init__.py", line 867, in resolve
    pkg_resources.DistributionNotFound: The 'google-api-core' distribution was not found and is required by the application
    Failed to execute script main
    

    Build command is following.

    py-cloud-fn video http -p -f main.py && cd cloudfn/target && gcloud beta functions deploy video --trigger-http --stage-bucket mybucket && cd ../..
    

    Once I added following line to cloudfn/hooks/hook-google.cloud.storage.py It was fixed on emulator. However I still have same error on production.

    datas += copy_metadata('google-api-core')
    

    Do you have any idea? I guess some google lib changed dependency but not certain at the moment.

    I'm using following google libraries

    google-auth==1.0.1
    google-cloud==0.27.0
    google-cloud-bigquery==0.28.0
    google-cloud-storage==1.6.0
    

    macOS Sierra version 10.12.6 Python 2.7.10

    Thanks!

    opened by seijik42 11
  • TypeError: req.set is not a function

    TypeError: req.set is not a function

    I used the function.py 's handle_http as my cloud function to be built

    def handle_http(req):
        
        biquery_client = bigquery.Client(credentials=get_credentials())
        
        if req.method == 'OPTIONS':
            return JsonResponse({"status":"success"},status=200,safe=False)
        
        if req.method == 'GET':
            print("Body: ",type(req.GET.getlist('image')))
            print(type(req.GET.getlist('image')),req.GET.getlist('image'))
    
            i=req.GET.getlist('image')
            i=''.join(str(e) for e in i)
    
            print(i)
    
            rID = req.GET.getlist('refID')
            rTable = req.GET.getlist('refTable')
            print(rID," ",rTable)
            ########### main custom function. which I am calling ##################
            mainP(i,rID,rTable)
    
            return Response(
                status_code=200,
                body={'key': 2},
                headers={'content-type': 'application/json'},
            )
    
    
    handle_http_event(handle_http)
    

    This was the index.js generated after the build below

    var googleAuth = require('google-auto-auth')();
    //Handle Background events according to spec
    function shimHandler(data) {
      return new Promise((resolve, reject) => {
        googleAuth.getToken(function (err, oauthToken) {
          if (err) {
            reject()
          } else {
            const p = require('child_process').execFile('./dist/func/func', {
              env: Object.assign(process.env, {
                'GOOGLE_OAUTH_TOKEN': oauthToken,
              })
            });
            var lastMessage;
            p.stdin.setEncoding('utf-8');
            //Log standard err messages to standard err
            p.stderr.on('data', (err) => {
              console.error(err.toString());
            })
            p.stdout.on('data', (out) => {
              console.log(out.toString());
              lastMessage = out;
            })
            p.on('close', (code) => {
              if (code !== 0) {
                //This means the shim failed / panicked. So we reject hard.
                reject();
              } else {
                // Resolve the promise with the latest output from stdout
                // In case of shimming http, this is the response object.
                resolve(lastMessage);
              }
            });
            //Write the object/message/request to the shim's stdin and signal
            //End of input.
            p.stdin.write(JSON.stringify(data));
            p.stdin.end();
          }
        });
      });
    }
    
    //Handle http request
    function handleHttp(req, res) {
      var requestBody;
      switch (req.get('content-type')) {
        case 'application/json':
          requestBody = JSON.stringify(req.body);
          break;
        case 'application/x-www-form-urlencoded':
          //The body parser for cloud functions does this, so just play along
          //with it, sorry man! Maybe we should construct some kind of proper
          //form request body? or not. let's keep it this way for now, as
          //This is how cloud functions behaves.
          req.set('content-type', 'application/json')
          requestBody = JSON.stringify(req.body);
          break;
        case 'application/octet-stream':
          requestBody = req.body;
          break;
        case 'text/plain':
          requestBody = req.body;
          break;
      }
    
      var fullUrl = req.protocol + '://' + req.get('host') + req.originalUrl;
    
      var httpRequest = {
        'body': requestBody,
        'headers': req.headers,
        'method': req.method,
        'remote_addr': req.ip,
        'url': fullUrl
      };
    
      shimHandler(httpRequest)
      .then((result) => {
        data = JSON.parse(result);
        res.status(data.status_code);
        res.set(data.headers)
        res.send(data.body);
      })
      .catch(() => {
        res.status(500).end();
      })
    }
    
    //
    exports['handle_http'] = function(req, res) {
      return handleHttp(req, res);
    }//
    

    When testing the url generated locally using POSTMAN

    I'm getting this error

    {"stack":"TypeError: req.set is not a function\n at handleHttp (/Users/santhoshdc/Documents/LaunchTestOne/cloudfn/target/index.js:55:11)\n at exports.handle_http (/Users/santhoshdc/Documents/LaunchTestOne/cloudfn/target/index.js:90:10)\n at app.use (/Users/santhoshdc/.nvm/versions/node/v9.8.0/lib/node_modules/@google-cloud/functions-emulator/src/supervisor/worker.js:142:11)\n at Layer.handle [as handle_request] (/Users/santhoshdc/.nvm/versions/node/v9.8.0/lib/node_modules/@google-cloud/functions-emulator/node_modules/express/lib/router/layer.js:95:5)\n at trim_prefix (/Users/santhoshdc/.nvm/versions/node/v9.8.0/lib/node_modules/@google-cloud/functions-emulator/node_modules/express/lib/router/index.js:317:13)\n at /Users/santhoshdc/.nvm/versions/node/v9.8.0/lib/node_modules/@google-cloud/functions-emulator/node_modules/express/lib/router/index.js:284:7\n at Function.process_params (/Users/santhoshdc/.nvm/versions/node/v9.8.0/lib/node_modules/@google-cloud/functions-emulator/node_modules/express/lib/router/index.js:335:12)\n at next (/Users/santhoshdc/.nvm/versions/node/v9.8.0/lib/node_modules/@google-cloud/functions-emulator/node_modules/express/lib/router/index.js:275:10)\n at app.use (/Users/santhoshdc/.nvm/versions/node/v9.8.0/lib/node_modules/@google-cloud/functions-emulator/src/supervisor/worker.js:114:7)\n at Layer.handle [as handle_request] (/Users/santhoshdc/.nvm/versions/node/v9.8.0/lib/node_modules/@google-cloud/functions-emulator/node_modules/express/lib/router/layer.js:95:5)","message":"req.set is not a function","name":"TypeError"}

    @MartinSahlen or anyone else who knows what's going on here, help please?

    opened by santhoshdc1590 6
  • Flask response TypeError: is not JSON serializable

    Flask response TypeError: is not JSON serializable

    Running using cloud-function-python using flask

    Can get the data but getting 500 error like this

    How do I fix this issue?

    [13] Failed to execute script function Traceback (most recent call last): File "function.py", line 34, in File "site-packages/cloudfn/flask_handler.py", line 50, in handle_http_event File "json/init.py", line 230, in dumps File "json/encoder.py", line 198, in encode File "json/encoder.py", line 256, in iterencode File "json/encoder.py", line 179, in default TypeError: b'{\n "json": {\n "empID": "I123", \n"refID": "69", \n "refTable": "123456"\n }, \n "message": "Hello world!"\n}\n' is not JSON serializable

    Anyone help me out here?

    opened by santhoshdc1590 5
  • Hidden imports

    Hidden imports

    I'm using python3.5

    While building the function using py-cloud-fn handle_http http -f function.py --python_version 3.5

    I got these hidden import errors

    Analyzing hidden import \'htmlentitydefs\'\n4349
    ERROR: Hidden import \'htmlentitydefs\' not found\n4349 
    INFO: Analyzing hidden import \'HTMLParser\'\n4350 
    ERROR: Hidden import \'HTMLParser\' not found\n4350 
    INFO: Analyzing hidden import \'Cookie\'\n4350 
    ERROR: Hidden import \'Cookie\' not found\n4350 
    INFO: running Analysis out00-Analysis.toc\n4376
    

    Checked import in the official links

    Note The htmlentitydefs module has been renamed to html.entities in Python 3. The 2to3 tool will automatically adapt imports when converting your sources to Python 3. official link

    We do have HTMLParser in python3.5 as well according to the official link

    We do have cookie in the python3.5 according to this official link

    These can be included using hidden imports

    And I can see all these hidden imports being added here

    Then why am I still getting this error?

    Is there a fix needed to be made here? If yes how can i or am I missing something here which I have done wrong?

    Any pointers would really be helpful

    opened by santhoshdc1590 5
  • Ubuntu 17.04 reached EOL

    Ubuntu 17.04 reached EOL

    When building the 3.5 image, it fails with:

    Reading package lists...
    W: The repository 'http://security.ubuntu.com/ubuntu zesty-security Release' does not have a Release file.
    W: The repository 'http://archive.ubuntu.com/ubuntu zesty Release' does not have a Release file.
    W: The repository 'http://archive.ubuntu.com/ubuntu zesty-updates Release' does not have a Release file.
    W: The repository 'http://archive.ubuntu.com/ubuntu zesty-backports Release' does not have a Release file.
    E: Failed to fetch http://security.ubuntu.com/ubuntu/dists/zesty-security/universe/source/Sources  404  Not Found [IP: 91.189.88.149 80]
    E: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/zesty/universe/source/Sources  404  Not Found [IP: 91.189.88.152 80]
    E: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/zesty-updates/universe/source/Sources  404  Not Found [IP: 91.189.88.152 80]
    E: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/zesty-backports/universe/binary-amd64/Packages  404  Not Found [IP: 91.189.88.152 80]
    E: Some index files failed to download. They have been ignored, or old ones used instead.
    

    This is because 17.04 reached end-of-life a few weeks ago.

    Merely using the 17.10 image has a new error:

    Step 1/4 : FROM ubuntu:17.10
     ---> a8ad041f5225
    Step 2/4 : RUN   apt-get update &&   DEBIAN_FRONTEND=noninteractive     apt-get install -y       python3.5       python3-pip   &&   apt-get clean &&   rm -rf /var/lib/apt/lists/*
     ---> Using cache
     ---> e205e19f7ef7
    Step 3/4 : RUN python3.5 -m pip install pip==9.0.1
     ---> Running in 06f16e1152a7
    /bin/sh: 1: python3.5: not found
    

    I'll try and solve it, but if anyone has any ideas...

    opened by opyate 4
  • [SSL: TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version (_ssl.c:719)

    [SSL: TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version (_ssl.c:719)

    Can't see to build and install

    Processing dependencies for pycloudfn==0.1.209 Searching for google-auth==1.3.0 Reading https://pypi.python.org/simple/google-auth/ Download error on https://pypi.python.org/simple/google-auth/: [SSL: TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version (_ssl.c:719) -- Some packages may not be found! Couldn't retrieve index page for 'google-auth' Scanning index of all packages (this may take a while) Reading https://pypi.python.org/simple/ Download error on https://pypi.python.org/simple/: [SSL: TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version (_ssl.c:719) -- Some packages may not be found! No local packages or working download links found for google-auth==1.3.0 error: Could not find suitable distribution for Requirement.parse('google-auth==1.3.0')

    seems pip is having an issue Could not fetch URL... problem confirming the ssl certificate

    got it fixed locally with the comment by @lucalenardi in the above link

    issue occurs when try to build install cloud function python

    opened by santhoshdc1590 3
  • Could not install packages due to an EnvironmentError: [Errno 13] Permission denied

    Could not install packages due to an EnvironmentError: [Errno 13] Permission denied

    OS:

      Mac
    

    Python:

      Python3
    

    Command:

      pip3 install pycloudfn
    

    Error:

      Installing collected packages: pefile, altgraph, macholib, pyinstaller, six, python-dateutil, werkzeug, django, Jinja2, futures, pyspin, pyasn1-modules, cachetools, google-auth, pycloudfn
        Found existing installation: six 1.11.0
          Uninstalling six-1.11.0:
            Successfully uninstalled six-1.11.0
        Rolling back uninstall of six
      Could not install packages due to an EnvironmentError: [Errno 13] Permission denied: '/usr/local/lib/python3.6/site-packages/six.py'
      Consider using the `--user` option or check the permissions
    
    opened by ACPK 3
  • finished with status code: 500

    finished with status code: 500

    I was successful in running the python code I want by deploying it on cloud function. 🎉🎉🎉🎉

    This is my function.py file content.

    from FTUL import mainP
    from cloudfn.google_account import get_credentials
    from cloudfn.http import handle_http_event, Response
    from google.cloud import bigquery
    import json
    
    def handle_http(req):
        
        biquery_client = bigquery.Client(credentials=get_credentials())
           
        if req.method == 'POST':
            #extract information from the body of the POST request
            rBody = json.loads(req.body)
            im = rBody['image']
            rID = rBody['refID']
            rTable = rBody['refTable']
            # Do the required operation from the extracted info
            mainP(im,rID,rTable)
    
            return Response(
                status_code=200,
            )
    
    
    handle_http_event(handle_http)
    

    The cloud function runs as expected, but always ends with error code 500

    When I check the logs of google.

    this is what is being printed

    { insertId: "some code"
    labels: { execution_id: "some id"
    } logName: "projects/network-api-production/logs/cloudfunctions.googleapis.com%2Fcloud-functions"
    receiveTimestamp: "2018-03-28T11:34:48.880241330Z"
    resource: { labels: { function_name: "handle_http"
    project_id: "network-api-production"
    region: "us-central1"
    } type: "cloud_function"
    } severity: "DEBUG"
    textPayload: "Function execution took 5026 ms, finished with status code: 500"
    timestamp: "2018-03-28T11:34:43.524350461Z"

    severity: "DEBUG" can be seen here in LogSeverity as (100) Debug or trace information

    Can anyone help me resolve the issue?

    opened by santhoshdc1590 3
  • NameError: name 'bigquery' is not defined

    NameError: name 'bigquery' is not defined

    I deployed my function.py on google cloud

    I am getting NameError: name 'bigquery' is not defined error in error logs when a hit the google cloud function URL.

    I have added below code

    from cloudfn.google_account import get_credentials
    
    biquery_client = bigquery.Client(credentials=get_credentials())
    

    I have no idea what's happening

    My bigquery API is already enabled according to this post

    Can anyone help?

    opened by santhoshdc1590 3
  • Bump django from 1.11 to 2.2.24 in /examples/django

    Bump django from 1.11 to 2.2.24 in /examples/django

    Bumps django from 1.11 to 2.2.24.

    Commits
    • 2da029d [2.2.x] Bumped version for 2.2.24 release.
    • f27c38a [2.2.x] Fixed CVE-2021-33571 -- Prevented leading zeros in IPv4 addresses.
    • 053cc95 [2.2.x] Fixed CVE-2021-33203 -- Fixed potential path-traversal via admindocs'...
    • 6229d87 [2.2.x] Confirmed release date for Django 2.2.24.
    • f163ad5 [2.2.x] Added stub release notes and date for Django 2.2.24.
    • bed1755 [2.2.x] Changed IRC references to Libera.Chat.
    • 63f0d7a [2.2.x] Refs #32718 -- Fixed file_storage.test_generate_filename and model_fi...
    • 5fe4970 [2.2.x] Post-release version bump.
    • 61f814f [2.2.x] Bumped version for 2.2.23 release.
    • b8ecb06 [2.2.x] Fixed #32718 -- Relaxed file name validation in FileField.
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 0
  • Bump django from 1.11.1 to 2.2.24

    Bump django from 1.11.1 to 2.2.24

    Bumps django from 1.11.1 to 2.2.24.

    Commits
    • 2da029d [2.2.x] Bumped version for 2.2.24 release.
    • f27c38a [2.2.x] Fixed CVE-2021-33571 -- Prevented leading zeros in IPv4 addresses.
    • 053cc95 [2.2.x] Fixed CVE-2021-33203 -- Fixed potential path-traversal via admindocs'...
    • 6229d87 [2.2.x] Confirmed release date for Django 2.2.24.
    • f163ad5 [2.2.x] Added stub release notes and date for Django 2.2.24.
    • bed1755 [2.2.x] Changed IRC references to Libera.Chat.
    • 63f0d7a [2.2.x] Refs #32718 -- Fixed file_storage.test_generate_filename and model_fi...
    • 5fe4970 [2.2.x] Post-release version bump.
    • 61f814f [2.2.x] Bumped version for 2.2.23 release.
    • b8ecb06 [2.2.x] Fixed #32718 -- Relaxed file name validation in FileField.
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 0
  • Bump djangorestframework from 3.6.3 to 3.11.2 in /examples/django

    Bump djangorestframework from 3.6.3 to 3.11.2 in /examples/django

    Bumps djangorestframework from 3.6.3 to 3.11.2.

    Release notes

    Sourced from djangorestframework's releases.

    Version 3.9.3

    This is the last Django REST Framework release that will support Python 2. Be sure to upgrade to Python 3 before upgrading to Django REST Framework 3.10.

    • Adjusted the compat check for django-guardian to allow the last guardian version (v1.4.9) compatible with Python 2. #6613

    Version 3.9.2

    See Release Notes for details.

    Version 3.9.1

    Change Notes: https://www.django-rest-framework.org/community/release-notes/#39x-series

    Verision 3.9.0

    Release announcement: https://www.django-rest-framework.org/community/3.9-announcement/

    Change Notes: https://www.django-rest-framework.org/community/release-notes/#39x-series

    Version 3.8.2

    Point release for 3.8.x series

    • Fix read_only + default unique_together validation. #5922
    • authtoken.views import coreapi from rest_framework.compat, not directly. #5921
    • Docs: Add missing argument 'detail' to Route #5920

    Version 3.8.1

    • Use old url_name behavior in route decorators #5915

      For list_route and detail_route maintain the old behavior of url_name, basing it on the url_path instead of the function name.

    Version 3.8

    • Release Announcement

    • 3.8.0 Milestone

    • Breaking Change: Alter read_only plus default behaviour. #5886

      read_only fields will now always be excluded from writable fields.

      Previously read_only fields with a default value would use the default for create and update operations.

      In order to maintain the old behaviour you may need to pass the value of read_only fields when calling save() in the view:

        def perform_create(self, serializer):
            serializer.save(owner=self.request.user)
      

    ... (truncated)

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 0
  • Bump jinja2 from 2.9.6 to 2.11.3

    Bump jinja2 from 2.9.6 to 2.11.3

    Bumps jinja2 from 2.9.6 to 2.11.3.

    Release notes

    Sourced from jinja2's releases.

    2.11.3

    This contains a fix for a speed issue with the urlize filter. urlize is likely to be called on untrusted user input. For certain inputs some of the regular expressions used to parse the text could take a very long time due to backtracking. As part of the fix, the email matching became slightly stricter. The various speedups apply to urlize in general, not just the specific input cases.

    2.11.2

    2.11.1

    This fixes an issue in async environment when indexing the result of an attribute lookup, like {{ data.items[1:] }}.

    2.11.0

    This is the last version to support Python 2.7 and 3.5. The next version will be Jinja 3.0 and will support Python 3.6 and newer.

    2.10.3

    2.10.2

    2.10.1

    2.10

    Primary changes

    Install or upgrade

    Install from PyPI with pip:

    ... (truncated)

    Changelog

    Sourced from jinja2's changelog.

    Version 2.11.3

    Released 2021-01-31

    • Improve the speed of the urlize filter by reducing regex backtracking. Email matching requires a word character at the start of the domain part, and only word characters in the TLD. :pr:1343

    Version 2.11.2

    Released 2020-04-13

    • Fix a bug that caused callable objects with __getattr__, like :class:~unittest.mock.Mock to be treated as a :func:contextfunction. :issue:1145
    • Update wordcount filter to trigger :class:Undefined methods by wrapping the input in :func:soft_str. :pr:1160
    • Fix a hang when displaying tracebacks on Python 32-bit. :issue:1162
    • Showing an undefined error for an object that raises AttributeError on access doesn't cause a recursion error. :issue:1177
    • Revert changes to :class:~loaders.PackageLoader from 2.10 which removed the dependency on setuptools and pkg_resources, and added limited support for namespace packages. The changes caused issues when using Pytest. Due to the difficulty in supporting Python 2 and :pep:451 simultaneously, the changes are reverted until 3.0. :pr:1182
    • Fix line numbers in error messages when newlines are stripped. :pr:1178
    • The special namespace() assignment object in templates works in async environments. :issue:1180
    • Fix whitespace being removed before tags in the middle of lines when lstrip_blocks is enabled. :issue:1138
    • :class:~nativetypes.NativeEnvironment doesn't evaluate intermediate strings during rendering. This prevents early evaluation which could change the value of an expression. :issue:1186

    Version 2.11.1

    Released 2020-01-30

    • Fix a bug that prevented looking up a key after an attribute ({{ data.items[1:] }}) in an async template. :issue:1141

    ... (truncated)

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 0
  • Bump werkzeug from 0.12 to 0.15.3

    Bump werkzeug from 0.12 to 0.15.3

    Bumps werkzeug from 0.12 to 0.15.3.

    Release notes

    Sourced from werkzeug's releases.

    0.15.3

    • Blog: https://palletsprojects.com/blog/werkzeug-0-15-3-released/
    • Changes: https://werkzeug.palletsprojects.com/en/0.15.x/changes/#version-0-15-3

    0.15.2

    • Blog: https://palletsprojects.com/blog/werkzeug-0-15-2-released/
    • Changes: https://werkzeug.palletsprojects.com/en/0.15.x/changes/#version-0-15-2

    0.15.1

    • Blog: https://palletsprojects.com/blog/werkzeug-0-15-1-released/
    • Changes: https://werkzeug.palletsprojects.com/en/0.15.x/changes/

    0.15.0

    • Blog: https://palletsprojects.com/blog/werkzeug-0-15-0-released/
    • Changes: https://werkzeug.palletsprojects.com/en/0.15.x/changes/

    0.13

    Read the announcement here.

    Read the full changelog.

    Install from PyPI with pip:

    pip install -U Werkzeug
    
    Changelog

    Sourced from werkzeug's changelog.

    Version 0.15.3

    Released 2019-05-14

    • Properly handle multi-line header folding in development server in Python 2.7. (:issue:1080)
    • Restore the response argument to :exc:~exceptions.Unauthorized. (:pr:1527)
    • :exc:~exceptions.Unauthorized doesn't add the WWW-Authenticate header if www_authenticate is not given. (:issue:1516)
    • The default URL converter correctly encodes bytes to string rather than representing them with b''. (:issue:1502)
    • Fix the filename format string in :class:~middleware.profiler.ProfilerMiddleware to correctly handle float values. (:issue:1511)
    • Update :class:~middleware.lint.LintMiddleware to work on Python 3. (:issue:1510)
    • The debugger detects cycles in chained exceptions and does not time out in that case. (:issue:1536)
    • When running the development server in Docker, the debugger security pin is now unique per container.

    Version 0.15.2

    Released 2019-04-02

    • Rule code generation uses a filename that coverage will ignore. The previous value, "generated", was causing coverage to fail. (:issue:1487)
    • The test client removes the cookie header if there are no persisted cookies. This fixes an issue introduced in 0.15.0 where the cookies from the original request were used for redirects, causing functions such as logout to fail. (:issue:1491)
    • The test client copies the environ before passing it to the app, to prevent in-place modifications from affecting redirect requests. (:issue:1498)
    • The "werkzeug" logger only adds a handler if there is no handler configured for its level in the logging chain. This avoids double logging if other code configures logging first. (:issue:1492)

    Version 0.15.1

    Released 2019-03-21

    • :exc:~exceptions.Unauthorized takes description as the first
    ... (truncated)
    Commits
    • 9b1123a release version 0.15.3
    • 00bc43b unique debugger pin in Docker containers
    • 2cbdf2b Merge pull request #1542 from asottile/exceptions_arent_always_hashable
    • 0e669f6 Fix unhashable exception types
    • bdc17e4 Merge pull request #1540 from pallets/break-tb-cycle
    • 44e38c2 break cycle in chained exceptions
    • 777500b Merge pull request #1518 from NiklasMM/fix/1510_lint-middleware-python3-compa...
    • e00c7c2 Make LintMiddleware Python 3 compatible and add tests
    • d590cc7 Merge pull request #1539 from pallets/profiler-format
    • 0388fc9 update filename_format for ProfilerMiddleware.
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot ignore this [patch|minor|major] version will close this PR and stop Dependabot creating any more for this minor/major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 0
  • Add hooks to upstream pyinstaller

    Add hooks to upstream pyinstaller

    I came upon this repository while attempting to package a grpc and google cloud firestore project using pyinstaller, as upstream pyinstaller does not have the hooks necessary to package these. Could I add the hooks under cloudfn/hooks to upstream pyinstaller? I am new to github so I apologise if this issue is not the right place for this.

    opened by jiangbowen0 2
Owner
Martin Abelson Sahlen
Engineer, Entrepreneur and hobby musician. Co-Founder @alvindotai
Martin Abelson Sahlen
First Party data integration solution built for marketing teams to enable audience and conversion onboarding into Google Marketing products (Google Ads, Campaign Manager, Google Analytics).

Megalista Sample integration code for onboarding offline/CRM data from BigQuery as custom audiences or offline conversions in Google Ads, Google Analy

Google 76 Dec 29, 2022
Prisma Cloud utility scripts, and a Python SDK for Prisma Cloud APIs.

pcs-toolbox Prisma Cloud utility scripts, and a Python SDK for Prisma Cloud APIs. Table of Contents Support Setup Configuration Script Usage CSPM Scri

Palo Alto Networks 34 Dec 15, 2022
Python client for using Prefect Cloud with Saturn Cloud

prefect-saturn prefect-saturn is a Python package that makes it easy to run Prefect Cloud flows on a Dask cluster with Saturn Cloud. For a detailed tu

Saturn Cloud 15 Dec 7, 2022
💻 A fully functional local AWS cloud stack. Develop and test your cloud & Serverless apps offline!

LocalStack - A fully functional local AWS cloud stack LocalStack provides an easy-to-use test/mocking framework for developing Cloud applications. Cur

LocalStack 45.3k Jan 2, 2023
Get-Phone-Number-Details-using-Python - To get the details of any number, we can use an amazing Python module known as phonenumbers.

Get-Phone-Number-Details-using-Python To get the details of any number, we can use an amazing Python module known as phonenumbers. We can use the amaz

Coding Taggers 1 Jan 1, 2022
Simple Telegram Bot To Get Feedback from users & Some Other Features

FeedbackBot Simple Telegram Bot To Get Feedback from users & Some Other Features. Features Get Feedback from users Reply to user's feedback Customisab

Arun 18 Dec 29, 2022
The scope of this project will be to build a data ware house on Google Cloud Platform that will help answer common business questions as well as powering dashboards

The scope of this project will be to build a data ware house on Google Cloud Platform that will help answer common business questions as well as powering dashboards.

Shweta_kumawat 2 Jan 20, 2022
Get Notified about vaccine availability in your location on email & sms ✉️! Vaccinator Octocat tracks & sends personalised vaccine info everday. Go get your shot ! 💉

Vaccinater Get Notified about vaccine availability in your location on email & sms ✉️ ! Vaccinator Octocat tracks & sends personalised vaccine info ev

Mayukh Pankaj 6 Apr 28, 2022
Want to get your driver's license? Can't get a appointment because of COVID? Well I got a solution for you.

NJDMV-appoitment-alert Want to get your driver's license? Can't get a appointment because of COVID? Well I got a solution for you. We'll get you one i

Harris Spahic 3 Feb 4, 2022
Google scholar share - Simple python script to pull Google Scholar data from an author's profile

google_scholar_share Simple python script to pull Google Scholar data from an au

Paul Goldsmith-Pinkham 9 Sep 15, 2022
google-resumable-media Apache-2google-resumable-media (🥉28 · ⭐ 27) - Utilities for Google Media Downloads and Resumable.. Apache-2

google-resumable-media Utilities for Google Media Downloads and Resumable Uploads See the docs for examples and usage. Experimental asyncio Support Wh

Google APIs 36 Nov 22, 2022
An attendance bot that joins google meet automatically according to schedule and marks present in the google meet.

Google-meet-self-attendance-bot An attendance bot which joins google meet automatically according to schedule and marks present in the google meet. I

Sarvesh Wadi 12 Sep 20, 2022
Google Drive, OneDrive and Youtube as covert-channels - Control systems remotely by uploading files to Google Drive, OneDrive, Youtube or Telegram

covert-control Control systems remotely by uploading files to Google Drive, OneDrive, Youtube or Telegram using Python to create the files and the lis

Ricardo Ruiz 52 Dec 6, 2022
Easy Google Translate: Unofficial Google Translate API

easygoogletranslate Unofficial Google Translate API. This library does not need an api key or something else to use, it's free and simple. You can eit

Ahmet Eren Odacı 9 Nov 6, 2022
A python library for creating Slack slash commands using AWS Lambda Functions

slashbot Slashbot makes it easy to create slash commands using AWS Lambda functions. These can be handy for creating a secure way to execute automated

Eric Brassell 17 Oct 21, 2022
Python functions to run WASS stereo wave processing executables, and load and post process WASS output files.

wass-pyfuns Python functions to run the WASS stereo wave processing executables, and load and post process the WASS output files. General WASS (Waves

Mika Malila 3 May 13, 2022
A Telegram Music Bot with proper functions written in Python with Pyrogram and Py-Tgcalls.

⭐️ Yukki Music Bot ⭐️ A Telegram Music Bot written in Python using Pyrogram and Py-Tgcalls Ready to use method A Support Group and ready-to-use runnin

Shikhar Kumar 1000 Jan 3, 2023
An example of matrix addition, demonstrating the basic method of Python calling C library functions

Example for Python call C functions An example of matrix addition, demonstrating the basic method of Python calling C library functions. How to run Bu

Quantum LIu 2 Dec 21, 2021
ShadowMusic - A Telegram Music Bot with proper functions written in Python with Pyrogram and Py-Tgcalls.

⭐️ Shadow Music ⭐️ A Telegram Music Bot written in Python using Pyrogram and Py-Tgcalls Ready to use method A Support Group, Updates Channel and ready

TeamShadow 8 Aug 17, 2022