GithubHelp home page GithubHelp logo

goteofoundation / goteo-api Goto Github PK

View Code? Open in Web Editor NEW
4.0 6.0 4.0 907 KB

The source code for the Goteo APi - https://api.goteo.org

License: GNU Affero General Public License v3.0

Shell 1.69% Python 98.31%
goteo hacktoberfest crowdfunding

goteo-api's Introduction

GOTEO API

Build Status Code Climate Test Coverage

This is the code for the goteo api.

Please refer to the INSTALL.md file for info about installing this API.

Full documentation to use the official api can be found here: https://developers.goteo.org/doc/

Easy install using Vagrant:

The included Vagrantfile is ready to provision a ready-to-go system with a test database and all the required dependencies installed:

vagrant up
vagrant ssh
./run

Install/update dependencies:

./deployer

Run a test server on localhost:

./run

Flask command line order:

Cache clearing:

./console clearcache

Cache renewing:

./console renewcache

Crontab install for automatic cache renew:

./console crontab -i

Remove crontab install:

./console crontab -r

Running tests:

NOTE: Testing with the argument --reset-database will remove all tables in the test database!

Configure a proper config_test.py before testing

First time you may want to reset the test database:

./run-tests --reset-database

All tests at once (verbose):

./run-tests -v

Specific tests: (verbose, with echoes):

./run-tests goteoapi -v -s goteoapi/tests/testprojects.py

Running code coverage tests:

./run-tests --cover-html --with-coverage

Running code coverage tests with all packages:

./run-tests --cover-html --with-coverage --cover-package=goteoapi_reports --cover-package=goteoapi_digests

Tests uses nosetests. Same nosetests command arguments applies to run-tests script

Extending the API

To run the API with extra packages you must configure the variable MODULES int the file config.py (extra packages such as: goteoapi_reports, goteoapi_digests)

...

MODULES = {
    # reports endpoints
    'goteoapi_reports.controllers',
    # digests endpoints
    'goteoapi_digests.controllers'
}

...

Examples

Obtain a list of active projects:

curl -i --user "goteo:goteo" http://0.0.0.0:5000/projects

Getting details for a custom project:

curl -i --user "goteo:goteo" http://0.0.0.0:5000/projects/project-id

Filtering some data, in this case, all projectes published starting in october 2015:

curl --user "goteo:goteo" -i -X GET -H "Content-Type: application/json" -d '{"from_date":"2015-10-01"}' http://localhost:5000/projects/

Obtaining an error message:

curl -i --user "goteo:goteo" -X GET -H "Content-Type: application/json" http://0.0.0.0:5000/projects/

Response:

HTTP/1.0 400 BAD REQUEST
Content-Type: application/json
Content-Length: 53
Access-Control-Allow-Origin: *
Access-Control-Allow-Credentials: true
Access-Control-Allow-Methods: POST, OPTIONS, GET
Access-Control-Allow-Headers: Authorization
Access-Control-Max-Age: 1
Server: Werkzeug/0.10.4 Python/2.7.6
Date: Mon, 01 Feb 2016 13:36:53 GMT

{
    "message": "Bad Request",
    "status": 400
}

Check the full documentation here: https://developers.goteo.org/doc/

License

The code licensed here under the GNU Affero General Public License, version 3 AGPL-3.0 has been developed by the Goteo team led by Platoniq and subseque ntly transferred to the Fundación Goteo, as detailed in http://www.goteo.org/about#info6

This is a web tool that allows the receipt, review and publishing of collective campaigns for their collective funding and the receiving of collaborations a s well as the dynamic visualization of the support received, classification of initiatives and campaign tracking. The system also permits secure and distrib uted communication with users and between users, administration of highlighted projects on the home page and the creation of periodical publications such as blogs, a FAQ section and static pages.

goteo-api's People

Contributors

davidbeig avatar microstudi avatar pablocastellano avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

goteo-api's Issues

ImportError: No module named flask

Hi! I've been trying to get up the API for a long by using vagrant or local install and neither works.
it's someting about virtualenv or python dependencies (I already runed ./deployer):
This is the output of trying to run it with vagrant.

vagrant@ubuntu-xenial:/home/ubuntu/goteo-api$ ./run Using default config file [config.py]
./run: line 14: /home/ubuntu/goteo-api/virtualenv/bin/activate: No such file or directory
Traceback (most recent call last):
File "/home/ubuntu/goteo-api/run.py", line 3, in <module>
from goteoapi import app
File "/home/ubuntu/goteo-api/goteoapi/__init__.py", line 8, in <module>
from flask import Flask ImportError: No module named flask

It is worth mentioning that flask, virtualenv and every other dependency its already installed and config.py is properly configured.
Thank you and sorry for my english.

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.