Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removes references to the disabled sunlight api #881

Merged
merged 1 commit into from
May 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .env_sample
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
SUNLIGHT_API_KEY=""
GOOGLE_MAP_API_KEY=<google_map_key>
DJANGO_SECRET_KEY=<django_secret_key>
PROPUBLICA_API_KEY=<pro_publica_api_key>
Expand Down
5 changes: 2 additions & 3 deletions project/api/models/bill.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,12 @@


class BillSources:
SUNLIGHT = "sunlight" # we don't use sunlight in current implementation is just relic of the past
PROPUBLICA = "propublica"
SOURCES = [(SUNLIGHT, SUNLIGHT), (PROPUBLICA, PROPUBLICA)]
SOURCES = [(PROPUBLICA, PROPUBLICA)]


class Bill(models.Model):
id = models.CharField(max_length=255, primary_key=True) # from sunlight
id = models.CharField(max_length=255, primary_key=True)

title = models.CharField(max_length=1023)
short_title = models.CharField(max_length=1023)
Expand Down
25 changes: 0 additions & 25 deletions project/api/write.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,31 +236,6 @@ def deleteCivi(request):
return HttpResponseServerError(reason=str(e))


# TODO 1: profile image file upload
# TODO 2: redo user editing
# TODO 3: django forms
# @login_required
# def get_dist(request):
# '''
# Upon First registering or changing location information gets representative codes and addes them to the user array
# '''
# request = urllib2.Request("https://congress.api.sunlightfoundation.com/")
#
# #S3tting the key as the value of an X-APIKEY HTTP request header.
# data = {
# "apikey": APIKEY,
# "fields": [],
#
# }
# request.add_data(json.dumps(data))
#
# response = urllib2.urlopen(request)
# resp_parsed = json.loads(response.read())
# reps = [for rep in resp_parsed.data]
# Account.user(request.user).representatives = reps
#


@login_required
def editThread(request):
thread_id = request.POST.get("thread_id")
Expand Down
1 change: 0 additions & 1 deletion project/civiwiki/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@

# API keys
# returns None if not found in os.environ
SUNLIGHT_API_KEY = os.getenv("SUNLIGHT_API_KEY")
GOOGLE_API_KEY = os.getenv("GOOGLE_MAP_API_KEY")

# Channels Setup
Expand Down
3 changes: 0 additions & 3 deletions project/frontend_views/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ def user_profile(request, username=None):
"username": user,
"profile_image_form": UpdateProfileImage,
"google_map_api_key": settings.GOOGLE_API_KEY,
"sunlight_api_key": settings.SUNLIGHT_API_KEY,
}
return TemplateResponse(request, "account.html", data)

Expand All @@ -92,7 +91,6 @@ def user_setup(request):
"username": request.user.username,
"email": request.user.email,
"google_map_api_key": settings.GOOGLE_API_KEY,
"sunlight_api_key": settings.SUNLIGHT_API_KEY,
}
return TemplateResponse(request, "user-setup.html", data)

Expand Down Expand Up @@ -196,7 +194,6 @@ def settings_view(request):
"username": request.user.username,
"email": request.user.email,
"google_map_api_key": settings.GOOGLE_API_KEY,
"sunlight_api_key": settings.SUNLIGHT_API_KEY,
"lng": request_account.longitude,
"lat": request_account.latitude,
}
Expand Down
19 changes: 0 additions & 19 deletions project/webapp/static/js/account.js
Original file line number Diff line number Diff line change
Expand Up @@ -375,23 +375,4 @@ cw.AccountView = BB.View.extend({

return false;
},
// // SunlightAPI related functions
// getLegislators: function(coordinates){
// var _this = this;
// $.ajax({
// url: "https://congress.api.sunlightfoundation.com/legislators/locate?latitude=" + coordinates.lat + "&longitude="+ coordinates.lng + "&callback=?",
// headers:{"X-APIKEY": this.sunlightApiKey},
// dataType: "jsonp",
// success: function(data, status){
// _this.$('#rep-list').empty();
// _.each(data.results, function(rep){
// _this.$('#rep-text').addClass('hide');
// _this.$('#rep-list').append(_this.repChipTemplate({ rep : rep }));
// });
// },
// error: function(){
// Materialize.toast("Sunlight Error: Could not get representatives", 5000);
// }
// });
// }
});
29 changes: 0 additions & 29 deletions project/webapp/static/js/utils/locate.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,6 @@ cw.MapView = BB.View.extend({
options = options || {};

this.googleMapsApiKey = options.googleMapsApiKey;
this.sunlightApiKey = options.sunlightApiKey;
return this;
},

Expand Down Expand Up @@ -324,32 +323,4 @@ cw.MapView = BB.View.extend({
};
return fullAddress;
},

// SunlightAPI related functions
getLegislators: function(coordinates) {
var _this = this;
$.ajax({
url:
"https://congress.api.sunlightfoundation.com/legislators/locate?latitude=" +
coordinates.lat +
"&longitude=" +
coordinates.lng +
"&callback=?",
headers: { "X-APIKEY": this.sunlightApiKey },
dataType: "jsonp",
success: function(data, status) {
_this.$("#rep-list").empty();
_.each(data.results, function(rep) {
_this.$("#rep-text").addClass("hide");
_this.$("#rep-list").append(_this.repChipTemplate({ rep: rep }));
});
},
error: function() {
Materialize.toast(
"Sunlight Error: Could not get representatives",
2000
);
}
});
}
});
2 changes: 0 additions & 2 deletions project/webapp/templates/account.html
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@
<script type="text/javascript" src="{% static "js/account.js" %}"></script>

<script type="text/javascript">
// var sunlightApiKey = "{{ sunlight_api_key }}";

var username = '{{username}}';
var current_user = '{{request.user.username}}'
Expand All @@ -85,7 +84,6 @@
var accountView = new cw.AccountView({
model: accountModel,
current_user: current_user,
// sunlightApiKey: sunlightApiKey
});
accountModel.fetch();
accountView.render();
Expand Down
1 change: 0 additions & 1 deletion project/webapp/templates/user-setup.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@

<script type="text/javascript" src="{% static "js/user-setup.js" %}"></script>
<script type="text/javascript">
var sunlightApiKey = "{{ sunlight_api_key }}";
var accountUsername= "{{ username }}";
var accountModel = new cw.AccountModel({username: accountUsername});

Expand Down
3 changes: 1 addition & 2 deletions project/webapp/templates/user/settings.html
Original file line number Diff line number Diff line change
Expand Up @@ -120,15 +120,14 @@
<script type="text/javascript" src="{% static "js/utils/locate.js" %}"></script>
<script type="text/javascript">
var googleMapsApiKey = "{{ google_map_api_key }}";
var sunlightApiKey = "{{ sunlight_api_key }}";

location_data = {
lng: {{lng}},
lat: {{lat}}
}

var mapModel = new cw.Map({coordinates: location_data});
var mapView = new cw.MapView({model: mapModel, googleMapsApiKey: googleMapsApiKey, sunlightApiKey: sunlightApiKey});
var mapView = new cw.MapView({model: mapModel, googleMapsApiKey: googleMapsApiKey});

var data = {};
data.username = '{{user.username}}';
Expand Down
2 changes: 0 additions & 2 deletions readmes/local-setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ The above command should be run in the same directory as the requirements.txt fi
### Environment variables
There are several environment variables that are needed for things to work properly:

- SUNLIGHT_API_KEY
- GOOGLE_MAP_API_KEY
- REDIS_URL (optional)
- AWS_STORAGE_BUCKET_NAME (optional)
Expand All @@ -42,7 +41,6 @@ You can save some time and declare those environmental variables all at once wit
export DJANGO_SECRET_KEY=**********

# Third party
export SUNLIGHT_API_KEY=**********
export GOOGLE_MAP_API_KEY=**********

# PostgreSQL
Expand Down
1 change: 0 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ coreapi==2.3.3
psycopg2==2.8.6
Pillow==7.2.0
requests==2.24.0
sunlight==1.2.9

# Packages for development/testing
coverage==4.5.3
Expand Down