Request error on Flask - pythonanywhere

Trying to make a request from web App on Pythonanywhere (paid account) with a Flask. This works as needed on local PC, but receives an error on Pythonanywhere.
#app.route('/test/')
def test():
url_cookies='https://www.phoenixcontact.com/online/portal/ru/pxc/offcontext/'
headers = {'authority': 'www.phoenixcontact.com', 'method': 'GET','user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36'}
requestCookies = requests.get(url_cookies,headers=headers)
return 'Test'+requestCookies.text

pythonanywhere has a only allowed limited webpages to be scrapped with the free version. You can remove this restriction by upgrading to one of their premium plans.
You might consider using FreeHosts like OpenShift for hosting your app.

Related

Facebook bot / crawler not identifying itself as a bot (user agent != facebookexternalhit)?

I'm advertising on Facebook Ads
I'm getting lots of hits on my server with IPs from Facebook but they are not using the typical user agent "facebookexternalhit". The user agent looks like a legit user.
When you check the IP, it's registered under Facebook
So it's hard to detect bots and filter them out. Any idea why they do this and how to detect their IPs?
There's a list of IPs under Facebook Dev area, but that particular IP is not there either
An example:
173.252.95.13 - - [24/Mar/2022:02:19:08 +0000] "GET /in1?utm_source=FB&utm_campaign=C1&fbclid=IwAR0OnUl6Ih4zT-jRhZKnO4Z8xgRcAVN36Z9rNE6WaLtugI0nnnRn4c4Ujyk HTTP/1.1" 200 25186 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.74 Safari/537.36 Edg/99.0.1150.46"

SendGrid Emails Detecting Mobile vs. Tablet vs. Desktop Chart

how can i detect sendgrid email clients Mobile vs. Tablet vs. Desktop for example :
http://marketingland.com/34-percent-email-opens-now-happen-pc-83277
https://www.signupto.com/news/email-marketing-posts/analysing-your-performance-on-mobile-devices/
user agent string im getting from sendgrid
Mozilla/5.0 (Windows NT 5.1; rv:11.0) Gecko Firefox/11.0 (via ggpht.com GoogleImageProxy)
Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; WOW64; Trident/7.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; .NET4.0C; .NET4.0E; Microsoft Outlook 14.0.7172; ms-office; MSOffice 14)
Mozilla/5.0 (Linux; Android 4.4.4; XT1030 Build/SU6-7.7) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/33.0.0.0 Mobile Safari/537.36
problem here is when i receives email on gmail account. if i open my email on cell phone browser signature "GoogleImageProxy" same email if i open on desktop any browser signature is same "GoogleImageProxy", could be more same kind of issues gmail i noticed.
Have you tried parsing the UA string?
When I run those through an online parser I see distinct data.
In general though, SendGrid, yourself, and everyone will be limited by what comes back in the UA string.
But then again, how many people do you know who read their email from their cell browser, vs their phone's app? I think that's a very small edge case, and wouldn't worry about it.

Different redirect behavior between 2 AEM instances

I have a page protected with a closed user group. In one AEM instance, if an unauthenticated user tries to access the page, it redirects to the login form, as expected.
In another AEM instance, the user accessing the protected page doesn't get redirected to the login form. Instead the result is a 404.
Here's the access.log for the working instance:
10.10.10.10 - - 22/Nov/2016:11:59:01 -0600 "GET /protected-page.html HTTP/1.1" 200 352 "-" "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.99 Safari/537.36"
10.10.10.10 - admin 22/Nov/2016:11:59:01 -0600 "GET /system/sling/cqform/defaultlogin.html?resource=%2Fprotected-page.html&$$login$$=%24%24login%24%24 HTTP/1.1" 200 2267 "https://domain.com/protected-page.html" "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.99 Safari/537.36"
Here's the access.log for the not working instance:
10.10.10.11 - anonymous 22/Nov/2016:12:03:22 -0600 "GET /protected-page.html HTTP/1.1" 404 467 "-" "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.99 Safari/537.36"
The difference appears to be that the user ID for the working request is -, whereas in the broken one it's anonymous. I think this means that the broken AEM thinks that the user has already been authenticated and just doesn't have access.
Any idea why this is happening and how I can configure the second instance like the first one?
Make sure that anonymous user has permissions to see the CUG page. You get 404 because the user cannot see that resource at all.

etherpad-lite-cf doesn't work on ibm bluemix

i have a problem with Bluemix. I would like to install a Etherpad-lite, but I get the following message when I try to create a pad:
UserAgent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:39.0) Gecko/20100101 Firefox/39.0
TypeError: pad.collabClient is null in http://XXXXXXXX.mybluemix.net/javascripts/lib/ep_etherpad-lite/static/js/pad.js?callback=require.define at line 266'
UserAgent: Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.125 Safari/537.36
Uncaught TypeError: Cannot read property 'setChannelState' of null in http://xxxxxxx.mybluemix.net/javascripts/lib/ep_etherpad-lite/static/js/pad.js?callback=require.define at line 266'
What can i do?
I have less reputations, so I can not comment on this. Have you setup backend database ? I have my own Etherpad-lite up and running for months without any issue. I had to disable "ep_ldapauth": "0.2.0",though. I used mysql service as my backend, and bind to it.

Sometimes "The specified feature has been temporarily disabled for this application"

it sometimes returned :
{"error_code"=>"2000", "error_message"=>"The specified feature has been temporarily disabled for this application", "state"=>"d022a262e11b1a8bebe4bccb86319514e870fb6657b6aee8"}
from facebook when using facebook login
apache_log:
85.135.128.63 - - [08/May/2013:19:07:40 +0200] "GET /users/auth/facebook HTTP/1.1" 302 250 "http://www.itolar.com/" "Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.64 Safari/537.31"
85.135.128.63 - - [08/May/2013:19:07:41 +0200] "GET /users/auth/facebook/callback?error_code=2000&error_message=The+specified+feature+has+been+temporarily+disabled+for+this+application&state=d022a262e11b1a8bebe4bccb86319514e870fb6657b6aee8 HTTP/1.1" 500 728 "http://www.itolar.com/" "Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.64 Safari/537.31"
But when i tried two different accounts to do same thing, everything works fine
I am using omniauth-facebook on Ruby on Rails
Do anybody know whats wrong?
It sounds like you might be hitting a rate limit. Try making less frequent calls and/or optimizing them (ie via batch calls). Also check App Insights -> Activity & Errors.