[PYTHON] Let's make a spot sale service 3

Now that the DB design for the item management function is complete, let's create an api. The required api is

  1. Create a circle
  2. Get circle information
  3. Update circle information
  4. Item registration
  5. Get item information
  6. Item information update
  7. List of registered items

What a place, such as. There are quite a few.

This time I made a circle around. You can create a circle and change the icon and circle name.

https://github.com/nagai/freemarket/tree/20140405

New things I learned

About webapp2

When handling the image received by multipart / form-data (key is'circlecut')

Can access

cloud storage

Use Google Cloud Storage Python Client Library to access Cloud Storage on GAE https://developers.google.com/appengine/docs/python/googlecloudstorageclient/?hl=ja

Writing files to GCS

controller/user/api/circle.py


circlecutBlob  = self.request.get('circlecut')
circlecutType  = self.request.params["circlecut"].type

circlecutHash = hashlib.md5(circlecutBlob).hexdigest()
circlecutpath = Common.createCirclecutPath(circlecutHash)

gcs_file = gcs.open(circlecutpath,
						'w',
						content_type=circlecutType,
						options={},
						retry_params=gcs.RetryParams(backoff_factor=1.1))
gcs_file.write(circlecutBlob)
gcs_file.close()

The image that was sent by the POST request multipart / form-data is saved in CloudStorage with the file path of'/ freemarket / circlecut / MD5'. Recent App Engine has CloudStorage for local environment, and if it is the file saved this time, you can check it from the browser in the form of http: // localhost: 8080 / _ah / gcs / freemarket / circlecut / xxxxxx after starting devserver. Masu

Remaining tasks

  1. Item registration
  2. Get item information
  3. Item information update
  4. List of registered items

Future tasks

Recommended Posts

Let's make a spot sale service 2
Let's make a spot sale service 1
Let's make a spot sale service 3
Let's make a spot sale service 9 (Task Queue edition)
Let's make a spot sale service 8 (image uploader edition)
Let's make a spot sale service 4 (in Python mini Hack-a-thon)
Let's make a Discord Bot.
Make Responder a daemon (service)
Let's make a rock-paper-scissors game
Let's make a remote rumba [Hardware]
Let's make a remote rumba [Software]
Let's make a GUI with python.
Let's make a breakout with wxPython
Let's make a graph with python! !!
Let's make a shiritori game with Python
Make Jupyter Notebook a service on CentOS
Make Unity Accelerator a service on Linux
Let's make a voice slowly with Python
Let's make a simple language with PLY 1
Let's make a multilingual site using flask-babel
Let's make a web framework with Python! (1)
Let's make a tic-tac-toe AI with Pylearn 2
Let's make a combination calculation in Python
Let's make a Twitter Bot with Python!
Let's make a web framework with Python! (2)
Let's make a Backend plugin for Errbot
Let's replace UWSC with Python (5) Let's make a Robot
Let's make a module for Python using SWIG
Make a squash game
Let's make a Makefile and build it (super beginner)
Let's make a simple game with Python 3 and iPhone
Make a function decorator
Make a distance matrix
Let's make dependency management with pip a little easier
I'll make a password!
Let's make a Mac app with Tkinter and py2app
Let's make a spherical grid with Rhinoceros / Grasshopper / GHPython
Make a Nyan button
[Super easy] Let's make a LINE BOT with Python.
Let's easily make a math gif using Google Colaboratory
Make a Tetris-style game!
Let's make a cron program in Java! !! (Task Scheduler)
Make a Base64 decoder
Let's make a websocket client with Python. (Access token authentication)
Yes, let's make a Minecraft server (Oracle Linux + Spigot + Geyser)
Let's make a robot that solves the Rubik's Cube! 2 Algorithm
Let's make a robot that solves the Rubik's Cube! 1 Overview
Let's make a number guessing game in your own language!
Let's make a LINE bot using various services [ngrok edition]
Make a Blueqat backend ~ Part 1
Make a Blueqat backend ~ Part 2
Let's make Othello with wxPython
Let's make an Errbot plugin
[Django] Make a pull-down menu
Let's try a shell script
Make a LINE BOT (chat)
Let's make Splatoon AI! part.1
Let's make dice with tkinter
Let's draw a logistic function
Make a bookmarklet in Python
Make a fortune with Python