Can’t create pdf using python PDFKIT Error : ” No wkhtmltopdf executable found:”

The following should work without needing to modify the windows environment variables: import pdfkit path_wkhtmltopdf = r’C:\Program Files (x86)\wkhtmltopdf\bin\wkhtmltopdf.exe’ config = pdfkit.configuration(wkhtmltopdf=path_wkhtmltopdf) pdfkit.from_url(“http://google.com”, “out.pdf”, configuration=config) Assuming the path is correct of course (e.g. in my case it is r’C:\Program Files (x86)\wkhtmltopdf\bin\wkhtmltopdf.exe’).

Sinatra – API – Authentication

Sinatra has no built-in authentication support. There are some gems available, but most are designed for user authentication (i.e. for a website). For an API, they seem like overkill. It’s easy enough to make your own. Simply check the request params in each of your routes to see if they contain a valid API key, … Read more

Using Rspec, how do I test the JSON format of my controller in Rails 3.0.11?

I realize that setting :format => :json is one solution (as noted above). However, I wanted to test the same conditions that the clients to my API would use. My clients would not be setting the :format parameter, instead they would be setting the Accept HTTP header. If you are interested in this solution, here … Read more

Any way to throttle calls to a specific API in Chrome DevTools while leaving others unthrottled?

If you can change the URLs, there’s a site http://www.deelay.me/ that is a delay proxy for HTTP resources. For example, if you want URL http://example.com/example to be delayed by 5 seconds, change it to http://www.deelay.me/5000/http://example.com/example.

facebook Uncaught OAuthException: An active access token must be used to query information about the current user

Just check for the current Facebook user id $user and if it returned null then you need to reauthorize the user (or use the custom $_SESSION user id value – not recommended) require ‘facebook/src/facebook.php’; // Create our Application instance (replace this with your appId and secret). $facebook = new Facebook(array( ‘appId’ => ‘APP_ID’, ‘secret’ => … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)