Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to Access an API
#1
I'm new to Python ...

I have an API I need access to but I cannot find any documentation on how to do the coding to get access. I have searched all over the place and everything I have tried does not work.

This API was created in C#.

I am using PyCharm as my IDE.

Where do I place the DLL in my project folder and how do I code in my program to access and use this API?

Can anyone help?

Thanks ...
Reply
#2
You most give more info about the API.
(Dec-23-2022, 11:29 AM)TheGr8Schwazoli Wrote: Where do I place the DLL in my project folder and how do I code in my program to and use this API?
This is strange question that is usally not askes at all when try to acess a API.
To show a normal way to access access a API,eg can use OpenWeather.
So use Requests and then use the Json respone that API give back.
import requests

api_key = 'xxxxxxxxxxxxxxxx'
city = 'london'
celsius = 'metric'
url = f'http://api.openweathermap.org/data/2.5/weather?q={city}&units={celsius}&APPID={api_key}'
response = requests.get(url).json()

print(response.get('name'))
print(response['main'].get('temp'))
Output:
London 11.34
Reply
#3
(Dec-23-2022, 03:55 PM)snippsat Wrote: You most give more info about the API.
(Dec-23-2022, 11:29 AM)TheGr8Schwazoli Wrote: Where do I place the DLL in my project folder and how do I code in my program to and use this API?
This is strange question that is usally not askes at all when try to acess a API.
To show a normal way to access access a API,eg can use OpenWeather.
So use Requests and then use the Json respone that API give back.
import requests

api_key = 'xxxxxxxxxxxxxxxx'
city = 'london'
celsius = 'metric'
url = f'http://api.openweathermap.org/data/2.5/weather?q={city}&units={celsius}&APPID={api_key}'
response = requests.get(url).json()

print(response.get('name'))
print(response['main'].get('temp'))
Output:
London 11.34

The "API" is actually a number of DLL's that were generated via C#.

I want to access these DLL's via an import statement in Python but I can't seem to get it to work ....
Reply
#4
(Dec-23-2022, 04:37 PM)TheGr8Schwazoli Wrote: The "API" is actually a number of DLL's that were generated via C#.

I want to access these DLL's via an import statement in Python but I can't seem to get it to work ....
Do you think any one can help with this bye the info you have given Dodgy
How to ask Smart Questions
Reply
#5
(Dec-23-2022, 05:24 PM)snippsat Wrote:
(Dec-23-2022, 04:37 PM)TheGr8Schwazoli Wrote: The "API" is actually a number of DLL's that were generated via C#.

I want to access these DLL's via an import statement in Python but I can't seem to get it to work ....
Do you think any one can help with this bye the info you have given Dodgy
How to ask Smart Questions

Ok, so I have a third-party DLL that I want to get access to in a Python program. That's it ...

How is this done in Python?
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020