Giter VIP home page Giter VIP logo

pepper-api-poster's Introduction

Python API Poster

Simple python script to post contents of a JSON file to a RESTful API

Table of Contents

  1. Installation
  2. Necessary Components
  3. Connecting to a Different Database

Installation

Clone the repository.

$ git clone https://github.com/connellboyce/Python-API-Poster.git

Open the program in your IDE and run.

Necessary Components

  • Python 3
  • POST Permissions in a web API

Connecting to a Different Database

This program is specialized to write to the database for my Pepper Garden app, but this can be changed. There are a few things you will need to have set up first, however.

  1. You must have an API allowing POST requests
  2. You must have a JSON file containing an array of objects
  3. The JSON objects must be valid in the eyes of the desired API
    • Do not try to use a JSON object lacking required fields or having information the API will reject
  4. Replace the variables at the top of the Python script to match the API you would like to post to
    • url: This should be the API URL which allows POST requests
    • headers: This should include any HTTP headers that the API requires. Authorization headers, like the one in the variable currently, will usually expire. Make sure your headers are valid.
    • fileName: Put the name of the JSON file you would like to iterate through and POST in the directory here. The pepperList.json file is in the correct location for reference.
    • arrayName: This should be the name of the array contained inside the JSON file.
  5. Run the program

pepper-api-poster's People

Contributors

connellboyce avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.