1
I need to loop the Stack Overflow API to generate data from all forum users, but I don’t know how user ids are generated at the time of registration. Does anyone know how user Ids are generated? Not increasingly, I believe.
1
I need to loop the Stack Overflow API to generate data from all forum users, but I don’t know how user ids are generated at the time of registration. Does anyone know how user Ids are generated? Not increasingly, I believe.
2
To obtain the user list of one of the Stack Exchange sites:
http://api.stackexchange.com/2.2/users?site=[SiteDesejado]
Example: http://api.stackexchange.com/2.2/users?site=stackoverflow
To obtain the total of users of one of the sites:
http://api.stackexchange.com/2.2/info?site=[SiteDesejado]
Example: http://api.stackexchange.com/2.2/info?site=stackoverflow
Relevant element:
{
"items":[
{
"total_users":3321752
}
],
}
Buddy, yes. But it doesn’t literally come to all users as an answer.
@Pythowner If you repair at the end of the Json response, there is the following excerpt: "has_more":true,"quota_max":300,"quota_remaining":298
. This means that (1) the API says there are more users, so it works as a kind of pagination, and (2) there is a (daily) survey quota, so it may be necessary to continue the user listing another day. Behold this answer for more details and see how to list other pages from the user list.
Got it, but how do I figure out the total number of pages?
Browser other questions tagged python api stackexchange
You are not signed in. Login or sign up in order to post.
I don’t know if you can do that, if Sopt allows it.
– Jorge B.
Make the loop, there’s a way. I just don’t know how the ID of each user is created because it doesn’t seem that it is increasingly analyzing the amount of user with the size of the ID’s.
– Pythowner
Ids I believe are sequential, but have deleted users who are not listed. But why you need to know how they are generated?
– bfavaretto
To get the list of users of the site: http://api.stackexchange.com/docs/users (I don’t know how the python library handles this).
– bfavaretto
Because like I said, I need to get information from all the users, but if you take the site from the stack, from to know how many users there are, but there’s a much bigger ID than the maximum number of users, I thought it was the deleted ones, but the number is much higher so I wanted to know how the ID of each user is chosen to try to generate all the ID’s and then put them in a loop searching the data of each user.
– Pythowner
Some people use it like name the ID in the OS in English, where the number is giant. This idea of "know how the ID of each user is chosen" is bored and I recommend to forget it. Use the API to pull everyone and ready.
– brasofilo
Using the API the search pull all at once, does not answer me literally all forum users. At least I did not get return of all users here "http://api.stackexchange.com/docs/users".
– Pythowner
@Pythowner The result is paged; you need to request the other pages via the 'page' parameter (e.g., http://api.stackexchange.com/2.2/users?page=2&site=stackoverflow )
– OnoSendai
Yes, I understand that, but how do I know the maximum number of pages?
– Pythowner