I am having problem with doing simple things using Steams 64 bit id.
How can i use SteamAPI to get the general information? like displaying name, username, location.
I used SteamAuth to make my social authentication on website, which only has the function, that gets the id.
Example:
steamid = GetSteamID64()
username = GetUsername()
displayname = GetDisplay()
...
Does SteamAPI on have features related to this? is there any library in python that could support such thing?
There are a whole lot of WebAPI methods to get details about a Steam user. You seem to be looking for GetPlayerSummaries.
You'll need an API key to use it.
Related
I'm having a similar problem, but I haven't been able to find a solution.
api.get_user with Tweepy will not give description
I use tweepy (4.8.0) and auth 2.0 (bearer_token)
I tried to load user information by using get_user(...) like this
client = tweepy.Client(
bearer_token=bearer_token
)
result = client.get_user(username="name", user_fields=['created_at'])
I expected to get additional data put in the user_fields, but only simple basic data was passed.
Response(data=<User id=1234 name=NAME username=name>, includes={}, errors=[], meta={})
Maybe I'm missing something or made a mistake?
save me plz...
My answer to that question applies here as well.
From the relevant FAQ section in Tweepy's documentation:
Why am I not getting expansions or fields data with API v2 using Client?
If you are simply printing the objects and looking at that output, the string representations of API v2 models/objects only include the default attributes that are guaranteed to exist.
The objects themselves still include the relevant data, which you can access as attributes or by key, like a dictionary.
I am trying to find code examples on how G Suite is dealing with api calls in python. For example there is a method called insert: https://developers.google.com/admin-sdk/directory/v1/reference/users/insert#try-it which permits you to create new users under your enterprise.
The point is that they dont have an example on how you can do that and i find a bit difficult to figure it out through their documentation. Are there any know examples that i could consult?
This worked for me, also using the QuickStart guide.
First, build your user object with the minimum required fields.
Note, this is just a dictionary containing a basic representation of a user object.
The minimum fields to use look like this:
user = {"name": {"familyName": "Burton", "givenName": "Haniel",}, "password": "some_pass", "primaryEmail": "haniel#yourgsuitedomain.com",}
You can add or update additional fields like any other dictionary:
user["orgUnitPath"] = "/Imported"
Then, call the insert method like this in your main() program:
result = service.users().insert(body=user).execute()
Result should be a JSON representation returned by the Directory API with additional attributes that are automatically added by Google.
Some additional links in case anyone else finds it useful:
https://developers.google.com/resources/api-libraries/documentation/admin/directory_v1/python/latest/admin_directory_v1.users.html
I'm working on building a small script/app to handle user creation, updates, and password resets to automate provisioning from our student information system. Depending on how it goes I might post to GitHub and add links here to save others time.
I'm pretty new to the salesforce api. I've been employing the python module simple-salesforce in order to create leads. It works great, but it's really unclear to me how to do non-CRUDlike actions. For example, I want to programatically convert a lead into an account.
The salesforce GUI makes this easy. One would simply open the lead, then click the convert button. Does anyone out there know how to do this with simple-salesforce?
UPDATE
I found this describing the creation of an APEX resource Is there any REST service available in Saleforce to Convert Leads into Accounts?
I'm hoping there is a more elegant way to achieve this but I'll post what I do with simple salesforce's apex support if that's what ends up happening.
It looks like the best way to deal with this problem is to create an APEX class as detailed in the linked post. After creating that class, you can use simple salesforce to query it like this:
conversion_result = sf.apexecute('Lead/{id}'.format(id=lead_result['id']), method='GET')
A tip to anyone trying this: please make sure you create the class in a sandbox account. I tried for a good 20 minutes to create the apex class in our production environment without realizing that salesforce doesn't let you do that.
After making the changes in your sandbox you need to upload them to production. Of course, the environments are not connected by default! Here is an explanation on how to allow uploads to your production environment.
UPDATE:
Here is the test class I created for the linked APEX class. Salesforce requires test classes with 75% coverage. This doesn't actually test any functionality, it just passes Salesforce's arbitrary requirements.
#isTest
class RestLeadConvertTest{
#isTest static void testIt(){
Lead lead = new Lead();
lead.LastName = 'salesforce';
lead.Company = 'unittest';
insert lead;
RestRequest req = new RestRequest();
RestResponse res = new RestResponse();
req.requestURI = '/services/apexrest/Lead/' + lead.Id; //Request URL
req.httpMethod = 'GET';//HTTP Request Type
RestContext.request = req;
RestContext.response= res;
RestLeadConvert.doGet();
}
}
I'm having a bit of a problem figuring out how to generate user friendly links to products for sharing.
I'm currently using /product/{uuid4_of_said_product}
Which is working quite fine - but it's a bit user unfriendly - it's kind of long and ugly.
And I do not wish to use and id as it would allow users to "guess" products. Not that that is too much of an issue - I would like to avoid it.
Do you have any hints on how to generate unique, user friendly, short sharing urls based on the unique item id or uuid?
Have you tried these https://github.com/corpix/shortid and one for django here https://github.com/nebstrebor/django-shortuuidfield
As Seluck suggested I decided to go with base64 encoding and decoding:
In the model my "link" property is now built from the standard url + base64.urlsafe_b64encode(str(media_id))
The url pattern I use to match the base64 pattern:
base64_pattern = r'(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$'
And finally in the view we decode the id to load the proper data:
media_id = base64.urlsafe_b64decode(str(media_id))
media = Media.objects.get(pk=media_id)
So I am fairly new to the whole django / python environment. I have successfully installed the social-registration app with my django application. Users are able to sign in with facebook and it creates a record for a user in the auth_user table and into my app_customuser table but it does not save the email, first name, last name etc.
What I was wondering is where in the structure of the application should I be looking to place the code that takes the facebook information and saves the data into the database.
social-registration seems to be a bit simplistic; it's documentation definitely is. It's possible you can subclass the backends or potentially create your own backends based on those to store the additional fields, but that feels clunky even saying it.
It's probably not what you want to hear, but django-socialauth is much more widely used and better documented. It actually provides signals that you can hook into to save additional user data out of the box: http://django-social-auth.readthedocs.org/en/latest/signals.html
Django Facebook sounds exactly like what you are looking for
https://github.com/tschellenbach/Django-facebook
Stores
username, email, gender, birthday, about me, website, and optionally likes and friends
Very mature app, runs thousands of registrations daily on our site.