Skip to content

financica/python-proto-square-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

  1. Prereqs:

    • protobuf
    • go get github.com/twitchtv/twirp/protoc-gen-twirp_python
    • npm install protobufjs
  2. Run extract_protos.js in inspector on invoice page

  3. Then copy the new div to ./squareup.json

  4. node ./node_modules/protobufjs/cli/bin/pbjs -t proto2 squareup.json > squareup.proto
  5. Move the service definitions in squareup.proto to the bottom of the file; these aren't allowed inside messages

  6. Add option allow_alias = true; inside the CatalogObjectType enum above DO_NOT_USE.

  7. protoc --plugin=`which protoc-gen-twirp_python` --python_out=. --twirp_python_out=. -I. squareup.proto
  8. Modify __service_name in squareup_pb2_twirp.py to include the full package names.

  9. Change /twirp to /services

  10. Change the headers= dict in _make_request to

    • Content-type: application/x-protobuf
    • Accept: application/x-protobuf
  11. Now from python you can:

    req = _sym_db.GetSymbol("squareup.invoice.frontend.GetInvoiceRequest")()
    req.invoice_token = 'EzNe6oF5dAHLt9FsRAjbQg'
    client = InvoiceFrontendServiceClient('https://squareup.com')
    res =  client.get_invoice(req)
    print(res)

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published