Giter Site home page Giter Site logo

aachokey / sunscrape Goto Github PK

View Code? Open in Web Editor NEW
1.0 4.0 0.0 27 KB

A python library for scraping and parsing campaign finance data from the Florida Secretary of State's website.

License: MIT License

Python 100.00%
journalism campaign-finance scraper python python3 florida politics elections

sunscrape's Introduction

SunScrape

Build Status

A python library that scrapes and parses campaign finance data from the Florida Secretary of State's website.

Installation

This package isn't on PyPI yet, so install from the repo:

pip install git+https://github.com/SunSentinel/SunScrape.git

Usage

SunScrape makes it possible to grab campaign finance data in bulk in a usable, machine-readable format.

This library provides a way to search Florida's campaign finance portal either by a particular entity or a specific filing type.

By entity

Results can be obtained for a particular candidate or committee.

Candidate

Results for a candidate.

Committee

Results of a particular committee registered in the state. A list of these committees can be found here: https://dos.elections.myflorida.com/committees/ComLkupByName.asp

By filing

You can also search through all contributions, expenses or fund transfers reported to the SOS's office. Additional search terms can also be passed to these object:

  • candidate_first - Candidate first name
  • candidate_last - Candidate last name
  • from_date - Start date (MM/DD/YYYY)
  • to_date - End date (MM/DD/YYYY)
  • committee_name - Committee name, or partial name
  • election_id - See Election IDs
  • all_time - True or False, returns results for all years

Contributions

Expenses

Transfers

Example

>>> from sunscrape.contributions import ContributionScraper
>>> scraper = ContributionScraper(candidate_first='Ron', candidate_last='Desantis')
>>> scraper.results

[{'candidate': 'DeSantis, Ron', 'candidate_party': 'Republican', 'date': '2018-07-18', 'amount': '3000.00', 'type': 'CHE', 'contributor_name': '1188 PARTNERS, LLC', 'contributor_address': '2141 ALAQUA DRIVE', 'contributor_address2': 'LONGWOOD, FL 32779', 'contributor_occupation': 'INSURANCE', 'inkind_description': ''}...]

Known issues

Election IDs

The library allows finance records searches by election, but you need the election ID used by the Secretary of State. You can find these with the get_election_ids() method.

Searching by date

The SOS's expenditure and fund transfer search portals fail when specifying a date, so we excluded these options from the expenditures and transfers objects. Though it is still possible to use the arguments in contributions objects.

Development

Requirements

  • Python 3
  • Virtual environment

Steps

  1. Clone this repository: git clone https://github.com/SunSentinel/SunScrape.git
  2. Change into project directory: cd SunScrape
  3. Start up your virtual environment.
  4. Install SunScrape from local source: pip install -e .
  5. Install requirements: pip install -r requirements.txt or pipenv install for pipenv users.

Running tests

pytest

Contributing

Want to help out? Submit an issue or pull request.

License

MIT

sunscrape's People

Contributors

aachokey avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar

sunscrape's Issues

Scraper not working currently

The scraper does not return results at the moment and throws a 403: Forbidden error when trying to make a request to the state's website.

The state may have started requiring cookies or other authentication for requests.

Parse addresses

Current scrapers do not break down address fields by city, state and zipcode, but rather return all of that information into one field.

Implement a parser to break these out into separate fields when returning data.

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.