I've been using Twython (https://github.com/ryanmcgrath/twython) to tweet photos, description and a link. So on Twitter it is displayed as "...description... ...link... ...pic.twitter.com/XXX..."
The problem i have encountered is that these Twitter API requests used for the photo uploads quite often fail with: (403) "Forbidden: The request is understood, but it has been refused. An accompanying error message will explain why. This code is used when requests are being denied due to update limits. -- Error creating status."
A few notes:
https://upload.twitter.com is used for uploads, some sources indicate that using api.twitter.com or just HTTP (no SSL) might cause problems
Daily photo upload limit of 30 has NOT been reached by Twitter accounts that experience the problem
The tweet does NOT exceed 140 characters (I tried with just 2 word description of the photo and it still failed)
Does anyone have an idea what's wrong?
Thanks a lot.
I hit the same problem and as it turned out, the solution is to send status message encoded into UTF-8. I added debug print statement and my status output looked like this:
\u042d\u0442\u043e\u0442 \u0441\u0442\u0430\u0442\u0443\u0441 \u0431\u044b\u043b \u043f\u043e\u043b\u0443\u0447\u0435\u043d \u043f\u0430\u0440\u0441\u0438\u043d\u0433\u043e\u043c \u0432\u0435\u0431-\u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b
To convert it into UTF-8 it was necessary to do:
status.decode('unicode-escape').encode('utf-8')
> Этот статус был получен парсингом веб-страницы
Related
my company has an arcgis server, and i've been trying to geocode some address using the python requests packages.
However, as long as the input format is correct, the reponse.status_code is always"200", meaning everything is OK, even if the server didn't process the request properly.
( for example, if the batch size limit is 1000 records, and I sent an json input with 2000 records, it would still return status_code 200, but half of the records will get ignored. )
just wondering if there is a way for me to know if the server process the request properly or not?
A great spot to check is the server logs to start with. They are located in your ArcGIS server manager (https://gisserver.domain.com:6443/arcgis/manager). I would assume it would log some type of warning/info there if records were ignored, but it is not technically an error so there would be no error messages would be returned anywhere.
I doubt you'd want to do this but if you want to up your limit you can follow this technical article on how to do thathttps://support.esri.com/en/technical-article/000012383
Recently my code is facing intermittent issues with a bucket in S3 that is basically downloading, parsing and reuploading files, I'm using python and boto (not boto3) to do the S3 actions my version is boto 2.36.0 Do you have any idea why sometimes S3 gives that kind of errors.
Based on their documentation
https://docs.aws.amazon.com/AmazonS3/latest/API/mpUploadComplete.htmlç
Sample Response with Error Specified in Body
The following response indicates that an error occurred after the HTTP response header was sent. Note that while the HTTP status code is 200 OK, the request actually failed as described in the Error element.
But still is not really a good example of what's going on and why it happens sometimes
I've tried some manual uploads to my bucket using the same version but I haven't noticed anything while doing it manually
<?xml version="1.0" encoding="UTF-8"?>
<Error>
<Code>InternalError</Code>
<Message>We encountered an internal error. Please try again.</Message>
<RequestId>A127747D40AB1AC3</RequestId>
<HostId>Clz3f+rO2K1KfD0ZwSkpa9WnPvUh/mngdi99eDiSbdR0uzOP5a7RcYUem6ILYbtQdIJ02aUw2M4=</HostId>
</Error>
I'm trying to check if some URLs that are stored in my DB are still valid links or not. To achieve this, I am using httplib2 to request the HEAD status in order to avoid downloading the entire content of the page. And I was quite happy with the results.
But then I discovered some cases where the status code returned when using a HEAD request is not similar to the one returned with a GET request.
So, just in case of a bug in the library, I made some tests with different libraries (below is my "requests" lib test):
> import requests
> rg = requests.get("https://fr.news.yahoo.com/chemin-dames-l-hommage-personnel-pr%C3%A9sident-121005844.html")
> rh = requests.head("https://fr.news.yahoo.com/chemin-dames-l-hommage-personnel-pr%C3%A9sident-121005844.html")
> print("GET status code:", rg.status_code)
('GET status code:', 200)
> print("HEAD status code:", rh.status_code)
('HEAD status code:', 404)
But whatever lib I use, I still have a different GET & HEAD status for the same URL.
So, obviously the site maintainer decided to not return an identical status code for both HEAD and GET request... and that seems legit even if not recommended.
Is there a way to avoid this problem and still know if the link is a valid one without having to download the entire content of the almost 2 millions url that I need to verify?
I can double check with a GET request whenever a >400 status code is returned on a HEAD request but that seems like a dirty work to me.
It seems that you might have to do it the GET way. While HEAD should return 200 when the page is live, there is simply no guarantee for that, and it's up to the server how to implement it. In addition, some would argue that HEAD request should return 404. The specification simply says this about 404:
This status code is commonly used when the server does not wish to
reveal exactly why the request has been refused
You should also take into account all the errors and mistakes that can be present in the server implementation. A simple google search will show you just how many bugs of this sort there are. It may well be that HEAD returns 200, but GET is 404, so your suggested method of double checking only HEAD 404s, with GET requests won't be 100% reliable too.
I've been creating adsets, ads and creatives with FB ads API for a long time now, more precisely using the python SDK. For most of my campaign, I always encounter a 503 error at some point, when creating creatives by batch.
When trying to create 5 creatives, 4 out of 5 are successfully created, and for one of them (the 4th one in this case) I get the following error:
{"error":
{"message": "Service temporarily unavailable",
"type":"FacebookApiException",
"is_transient":false,
"code":2,
"error_subcode":1487172,
"error_user_title":"Could not save creative",
"error_user_msg":"Could not save creative"
}
I already created an issue on the SDK repo but I really think it's a problem of the API itself. Any idea? Are there any rate limitations? I couldn't find any documentation nor similar issue.
Thanks a lot!
The error subcode 1487172 is listed on the Marketing API Error Codes Facebook documentation page so it doesn't strike me as a rate limit error which is documented at https://developers.facebook.com/docs/marketing-api/api-rate-limiting.
For a batch request of 5 creatives do you always see 1 fail? Is there anything consistent between the failed creatives to suggest something wrong in the request?
You could also search the known bug list or create a new one, it does sound like this is an issue on the API side. See https://developers.facebook.com/bugs/
It is my first attempt of any internet application. I am trying to post on my blog from a text document in my PC using python. My code is here
f = open('proofs.txt')
data = f.readline()
print data
import wordpresslib
url = 'http://www.agnsa.wordpress.com/xmlrpc.php'
wp = wordpresslib.WordPressClient(url,'agnsa','pan#13579')
wp.selectBlog(0)
post = wordpresslib.WordPressPost()
post.title = 'try'
post.description = data
idPost = wp.newPost(post,True)
After running the module it is giving the error that connection failed to server. Here is the response. I tried to find about it but i couldnt understand how i can solve it. I never develop any such application before. It is simple but i cant understand what to do now.... Can any one give me suggestion what to do ??
Error is :
[Errno 10060] A connection attempt failed because the connected party did
not properly respond after a period of time, or established connection failed
because connected host has failed to respond
A few pointers to help you troubleshoot:
The domain http://www.agnsa.wordpress.com/ does not exist. Is this correct?
On wordpress, XMLRPC is not turned on by default. Go to Settings->Writing->Remote Publishing and check the box for XML-RPC on your account. More info on XML-RPC Support.
EDITED The correct path for XML RPC on wordpress, since you have a domain agneesa.wordpress.com would be http://agneesa.wordpress.com/wordpress/xmlrpc.php. See section on Endpoint.
Have you just published your password? StackOverflow has a trustworthy and helpful community. But I am not sure I would trust the rest of the world :)
If you have enable XML-RPC on the server side and the address in your comment is correct, then this code should work:
import wordpresslib
# dummy data to be on safe side
data = "Post content, just ensuring data is not empty"
url='http://agneesa.wordpress.com/wordpress/xmlrpc.php'
# insert correct username and password
wp=wordpresslib.WordPressClient(url,'agnsa','pan#13579')
wp.selectBlog(0)
post=wordpresslib.WordPressPost()
post.title='try'
post.description=data
idPost=wp.newPost(post,True)
The latest error suggests you cannot make a connection. It is either due to the wrong address in your code, or due to a failure on the side of the server (not accepting the connection for some reason). The same error was discussed in other questions on SO, here, here, and here -- while they do not relate to the library you are using, browsing the answers and related questions may be helpful in giving you leads.