Hey guys!
Some asshole ran into my car, and a witness gave me partial plate number. The cops are lazy and cannot fathom how to find a possible match for the plate.
However, i believe I can use crunch to generate a list that is acceptable , and I have found a website that will allow me to search a database of plate numbers.
I have been using python to try to put something together that would submit a single value out of the list to the url, and then return a result, and then repeat the process. However, since I know only a very little of programming, I am not sure I am googling the correct question.
I have already tested that I can create a script to send a single variable to the url, and it does return the correct result. How to automate a large list? I know I need a loop, but what concepts should I google to understand better what I am trying to dp?
Thanks, Op the Fag
bump cuz im pissed that this dude hit and ran me, and i want justice
for(listItem in yourListOfLicensePlates) do:
yourHttpQueryFunction(listItem)
look for "python foreach loop", " python list", "python split file to lines"
>>54382580
>>54382591
thanks guys
want a good laugh?
import requests
data = {'plate_number': '6a17020'}
r = requests.get('http://www.everify.com/driving/plateLoader.php?state=ca&type=vin', params=data)
print(r.url)
This seems to pass the defined value of the plate_number to the url as a variable. Trying to build off this.
>>54382580
Those parenthesis and do: aren't necessary at all. Yes that's right, I'm being a pythonic asshole.for plate in license_plates:
your_function(plate)
>>54382862
thanks:
import requests
data = {'plate_number': '6a17020' , 'plate_number': '864393'}
for plate in data:
r = requests.get('http://www.everify.com/driving/plateLoader.php?state=ca&type=vin', params=data)
print(r.url)
will loop through that list. I'm wondering now if it is easier to formate my crunch created list to include " 'plate_number': '1234567' , 'plate_number': '1234568' or if there is a better way to pass a list item as a variable to the function.
Now to figure out how to display the resultant data or write to a file or something for searching later..
>>54382795
you should add some http headers to your requests - it might not be necessary but if you're pounding the site, they might see your default python/requests user_agent and block you. Probably not though.import requests
data = {'plate_number': '6a17020'}
user_agent = 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.94 Safari/537.36'
headers = {'User-Agent': user_agent, 'Referer': 'http://www.everify.com/'}
r = requests.get('http://www.everify.com/driving/plateLoader.php?state=ca&type=vin', params=data, headers=headers)
print(r.url)
>>54382929
oh shit good point...who knows if anybody would even be paying attention but yeah thanks!
>>54382920
yeah right now you have a dictionarydata = {'plate_number': '6a17020' , 'plate_number': '864393'}
But what makes more sense is a listdata = ['6a17020' , '864393']
If you do choose to use a dictionary, you'll need to change your for loop to check the dict values - but a list makes way more sense IMO.
>>54383008
Yes, the list makes more sense.
Being i am a programming noob, I am trying to wrap my head around how to pass the list data to the variable the url expects which is plate_number=X.
Also I spoke too soon. The last code i posted only displays one result rather than two.
>>54383057
oh I see, so the url actually requires plate_number=?
so it's likehttp://www.everify.com/driving/plateLoader.php?state=ca&type=vin&plate_number=
?
If so, you just can change your requests url to ber = requests.get('http://www.everify.com/driving/plateLoader.php?state=ca&type=vin&plate_number={:d}'.format(plate), headers=headers)
This string formatting {:d} will insert an integer from your list into the url. Also make sure you've got print(r.url) indented to be inside your for loop. Indentation is super important in python.
Of course your final versio will have a write to excel file or write to db instead a print statement, but yeah. Gotta have it indented inside.for plate in data:
r = requests.get('http://www.everify.com/driving/plateLoader.php?state=ca&type=vin&plate_number={:d}'.format(plate), headers=headers)
print(r.url)
>>54383126
well shit, I should've said string instead of integer. Change that {:d} to a {:s}
>>54383173
dude you just made my day haha
>>54382376
Not thine own centurion, plebe
>>54383185
Now to work on doing something useful. I appreciate the spoon feeding guys, I really do. I want this hit and run asian lady with a white minivan of unknown make and model to suffer the wrath of the justice system indeed...
>>54383206
whatever, we all start somewhere...and i never intended to do any of this, but for lack of a better option...
>>54383185
That's printing out the urls but you want the contents of those pages right, like "match found - name"?
The requests library will let you do r.text to see all the html of the page. You can use another python library like BeautifulSoup to kind of sort the jumbled html for you. That's getting a little bit more in depth but you'll kinda need it if you want to actually check the contents of the urls. Luckily it's real easy to learn, just like the rest of python.
>>54383263
Yes, exactly.
I figured i would just search the html for relevant info, but yah that would suck. I take it Beautiful Soup allows you to configure which data to parse and display?
>>54382376
You should look up the python challenge, specifically look up a solution for the fourth problem. that should guide you down the right path
>>54383457
thanks man i will check it
>>54383263
thanks again my man, and to all who helped me!