Updating #AWS Lambda #Python version

If, like me, you have an old Lambda function running Python 3.8, you may have got this email from AWS today;


We are contacting you as we have identified that your AWS Account currently has one or more AWS Lambda functions using the Python 3.8 runtime.

We are ending support for Python 3.8 in Lambda on October 14, 2024. This follows Python 3.8 End-Of-Life (EOL) which is scheduled for October, 2024 [1].

As described in the Lambda runtime support policy [2], end of support for language runtimes in Lambda happens in several stages. Starting on October 14, 2024, Lambda will no longer apply security patches and other updates to the Python 3.8 runtime used by Lambda functions, and functions using Python 3.8 will no longer be eligible for technical support. Also, Python 3.8 will no longer be available in the AWS Console, although you can still create and update functions that use Python 3.8 via AWS CloudFormation, the AWS CLI, AWS SAM, or other tools. Starting February 28, 2025, you will no longer be able to create new Lambda functions using the Python 3.8 runtime. Starting March 31, 2025, you will no longer be able to update existing functions using the Python 3.8 runtime.

So, the first thing, is to find which lambda functions are affected, and this, I wrote a Windows Batch script as follows;

@echo off

set regions=us-east-1 us-east-2 us-west-1 us-west-2 ap-south-1 ap-northeast-1 ap-northeast-2 ap-southeast-1 ap-southeast-2 ca-central-1 eu-central-1 eu-west-1 eu-west-2 eu-west-3 sa-east-1

for %%r in (%regions%) do (
    echo Listing Lambda functions in %%r region:
    aws lambda list-functions --region %%r --output text --query "Functions[?Runtime=='python3.8'].FunctionArn"
    echo -----------------------------------------
)

Then, once I listed all the functions, it’s a matter of going to each one in the AWS Lambda console, scrolling down on the “Code” tab, to change the runtime;

To change the runtime
  1. Open the Functions page of the Lambda console.
  2. Choose the function to update and choose the Code tab.
  3. Scroll down to the Runtime settings section, which is under the code editor.
  4. Choose Edit.
    1. For Runtime, select the runtime identifier.
    2. For Handler, specify file name and handler for your function.
    3. For Architecture, choose the instruction set architecture to use for your function.
  5. Choose Save.

License plate lookup #API now in #Kazakhstan

If your business is in the Automotive trade, and operates in, or with partners in Kazahkstan, it can be useful to be able to determine details of a vehicle based on the license plate of that car, automatically. This API now does that; Which you can find at avtokolik.kz

Car registration plates in Kazakhstan use the /CheckKazakhstan endpoint and returns the
following information:
● Make / Model
● Age
● Engine Size
● Colour
● Region
● Representative image
Sample Registration Number:
860AMZ17
Sample Json:


{
"Description": "OPEL VECTRA",
"RegistrationYear": "1998",
"CarMake": {
"CurrentTextValue": "OPEL"
},
"CarModel": {
"CurrentTextValue": "VECTRA"
},
"MakeDescription": {
"CurrentTextValue": "OPEL"
},
"ModelDescription": {
"CurrentTextValue": "VECTRA"
},
"Colour": "БЕЛЫЙ",
126
"EngineSize": "1598",
"Region": "Jetisu Region",
"ImageUrl": "https://avtokolik.kz/image.aspx/@T1BFTCBWRUNUUkE="
}
  1. Make/Model: Instantly identify the brand and model of the vehicle. For instance, the sample plate “860AMZ17” reveals an Opel Vectra.
  2. Age: Gain insight into the vehicle’s registration year. In our example, the Opel Vectra was registered in 1998.
  3. Engine Size: Know the power under the hood with details about engine size. The Opel Vectra comes equipped with a 1598 cc engine.
  4. Colour: Discover the vehicle’s exterior color. In this case, the Opel Vectra is white (“БЕЛЫЙ”).
  5. Region: Understand the region where the vehicle is registered. The Opel Vectra in our example is registered in the Jetisu Region.
  6. Representative Image: Visualize the vehicle with a representative image. Simply follow the provided URL to see how the Opel Vectra looks.

Utilizing this endpoint not only satisfies curiosity about vehicles on the road but also offers practical insights for various purposes, from verifying vehicle details before purchasing to conducting research on vehicle demographics in different regions of Kazakhstan.

With this accessible tool, individuals and businesses can make informed decisions, whether it’s for personal use, insurance purposes, or market analysis. Embrace the power of technology to unlock a wealth of information hidden within Kazakhstan’s car registration plates.

Categories: Uncategorized Tags: , , , ,

Car Registration #API now available in #Switzerland


Introducing KennzeichenAPI:
Your Ultimate Swiss License Plate Lookup Tool

Whether you’re a curious car enthusiast, an insurance agent, or law enforcement personnel, having access to accurate and comprehensive vehicle information can be invaluable. Enter KennzeichenAPI, a groundbreaking new tool that brings clarity to the world of Swiss car registration plates.

Understanding Swiss License Plates

Switzerland boasts a unique system for car registration plates, each carrying a wealth of information about the vehicle it belongs to. From the make and model to technical specifications and even representative images, Swiss license plates hold the key to unlocking a vehicle’s history and characteristics.

Introducing KennzeichenAPI

KennzeichenAPI is a powerful API (Application Programming Interface) designed specifically to decode Swiss license plates effortlessly. With its user-friendly interface and robust functionality, KennzeichenAPI offers a seamless solution for retrieving detailed information about vehicles registered in Switzerland.

Features

1. Make and Model

Get instant access to the make and model of a vehicle, providing valuable insights into its brand and design.

2. Age

Discover the registration year and month of the vehicle, shedding light on its age and potentially its usage history.

3. Transmission and Fuel Type

Learn about the transmission system and fuel type of the vehicle, crucial details for both enthusiasts and professionals alike.

4. Doors and Body

Understand the number of doors and the body type of the vehicle, offering a glimpse into its structural design.

5. Engine Type and Size

Explore the engine specifications, including type and size, essential for evaluating performance and efficiency.

6. Euro Type Code

Access information about the Euro Type Code, providing insights into the vehicle’s compliance with European emissions standards.

7. Representative Image

Visualize the vehicle with a representative image, enhancing the overall user experience and facilitating identification.

How It Works

Using KennzeichenAPI is simple and straightforward. With just a license plate number, users can query the API and receive a JSON response containing all relevant information about the corresponding vehicle. Let’s take a look at a sample response:

jsonCopy code{
  "Description": "Honda CR-Z",
  "Variant": "CR-Z 1.5i Hybrid GT Coupé - 3 doors - 114 HP - Manuell - 35100 Fr.",
  "RegistrationYear": 2012,
  "RegistrationMonth": 9,
  "CarMake": {
    "CurrentTextValue": "Honda"
  },
  "CarModel": {
    "CurrentTextValue": "CR-Z"
  },
  "Transmission": "Manual",
  "EngineSize": "1497",
  "Power": "84",
  "FuelType": "Benzin / Elektrisch",
  "Doors": "0",
  "Body": "Limousine",
  "EngineType": "LEA1",
  "TypeCertificate": "1HA341",
  "EuroTypeCode": "e11*2007/46-79/2009*0100",
  "Co2": "117",
  "Region": "Aargau",
  "ImageUrl": "http://kennzeichenapi.ch/image.aspx/@SG9uZGEgQ1ItWg=="
}

Example Usage

Let’s say you come across a Swiss license plate with the registration number “AG364769.” By making a simple API call to the /CheckSwitzerland endpoint with this license plate number, you can retrieve comprehensive information about the corresponding vehicle, including its make, model, age, transmission, fuel type, and much more.

import requests

license_plate = "AG364769"
api_url = f"https://www.kennzeichenapi.ch/api/reg.asmx/CheckSwitzerland?licensePlate={license_plate}"

response = requests.get(api_url)
data = response.json()

print(data)

With KennzeichenAPI, unlocking the mysteries behind Swiss license plates has never been easier. Whether you’re conducting research, verifying vehicle details, or satisfying your curiosity, KennzeichenAPI empowers you with the information you need, right when you need it.

Get Started Today!

Ready to explore the world of Swiss license plates like never before? Visit KennzeichenAPI today and start harnessing the power of comprehensive vehicle information at your fingertips. Unlock the potential of Swiss license plates with KennzeichenAPI – your ultimate license plate lookup tool!

Car Registration Search #API now available in #Oman

Unveiling the Oman Car Registration API: Unlocking Vehicle Details with a License Plate

Discovering the Secrets Behind Oman’s Vehicle Market

Oman, a country known for its rich cultural heritage and breathtaking landscapes, is also home to a diverse and vibrant automobile market. With a growing economy and an increasing number of vehicles on the roads, there arises a need for a reliable and efficient solution to retrieve essential information about these cars. Introducing the Oman Car Registration API, a groundbreaking tool designed to look up vehicle details based on license plate numbers, providing a seamless experience for both individuals and businesses.

The Omani Car Market: A Glimpse

Oman boasts a diverse car market, with a mix of local and international brands gracing its roads. The country’s love for automobiles is evident in the variety of vehicles, ranging from sleek sedans to rugged off-road vehicles. As the number of registered vehicles continues to rise, there arises a demand for a convenient way to access crucial information about these cars swiftly and accurately.

Oman Car Registration API: Your Gateway to Vehicle Details

Website: http://om.carregistrationapi.com

The Oman Car Registration API provides a powerful and user-friendly solution for retrieving comprehensive vehicle information based on license plate numbers. By utilizing the /CheckOman endpoint, users can access a plethora of details, including:

  • Make / Model: Uncover the brand and specific model of the vehicle.
  • Age: Determine the registration year, providing insights into the car’s lifespan.
  • Colour: Identify the color of the car, adding an extra layer of detail.
  • VIN (Vehicle Identification Number): Retrieve the unique code that distinguishes each vehicle.
  • Engine Number: Access the specific identification code for the car’s engine.
  • Insurer: Learn about the insurance provider associated with the vehicle.
  • Insurance Expiry: Stay informed about the insurance validity, ensuring compliance with regulations.
  • Representative Image: Visualize the vehicle with a representative image for better recognition.

A Glimpse into the Data

To demonstrate the capabilities of the Oman Car Registration API, consider the following sample registration number:

Sample Registration Number: 69385H

Sample JSON Output:

{
"Description": "NISSAN SUNNY",
"RegistrationYear": "2023",
"CarMake": { "CurrentTextValue": "NISSAN" },
"CarModel": { "CurrentTextValue": "SUNNY" },
"VIN": "MDHBN7AD1KG646954",
"Colour": "WHITE",
"EngineNumber": "HR15-752304G",
"InsuranceExpire": "04/01/2024",
"InsuranceCompany": "Oman United Insurance Company",
"ImageUrl": "http://om.carregistrationapi.com/image.aspx/@TklTU0FOIFNVTk5Z"
}

This sample output showcases the detailed information available, from the vehicle’s make and model to its insurance details, providing a comprehensive overview for users.

How to Get Started

Using the Oman Car Registration API is simple. Visit http://om.carregistrationapi.com and explore the potential of unlocking valuable vehicle information effortlessly.

Whether you are a car enthusiast seeking details about a specific model or an insurance professional verifying policy information, the Oman Car Registration API is your go-to solution. Embrace the power of data and elevate your understanding of Oman’s dynamic car market with this cutting-edge tool.

Verify an Emirates ID via a Free #API

Using RapidAPI – on this page: https://rapidapi.com/fvetroo5ri/api/verify-emirates-id

There is a free API that returns the name / address / dob from an emirates ID (think UAE / Dubai / Abu Dhabi), sample code as follows:

https://rapidapi.com/fvetroo5ri/api/verify-emirates-id
curl --request GET \

--url 'https://verify-emirates-id.p.rapidapi.com/default/EmiratesID?eid=784197600000000' \
--header 'X-RapidAPI-Host: verify-emirates-id.p.rapidapi.com' \
--header 'X-RapidAPI-Key: KEY GOES HERE'

and it returns data in the format;

{
"FirstName": "Mohammed",
"LastName": "Fatah",
"DateOfBirth": "1979-05-05",
"Emirate": "Dubai",
"Address": "Sheikh Mohammed Bin Rashed Boulevard Downtown Dubai, PO Box 123234 Dubai, UAE"
}

Very nice ... could be useful for KYC:
https://rapidapi.com/fvetroo5ri/api/verify-emirates-id
Categories: Uncategorized

License plate lookup #API now added support for #Tunisia

We are excited to announce that our License Plate Lookup API has now extended its services to include support for Tunisia. This latest update brings a valuable tool to the Tunisian market, enabling users to retrieve detailed vehicle information from a license plate number.

Technical Details of the Tunisia Support

Our API, accessible at the endpoint https://www.vehiculeapi.tn/api/reg.asmx?op=CheckTunisia, can now process car registration plates from Tunisia and return comprehensive vehicle details. This enhancement is tailored to meet the specific format of Tunisian license plates.

Understanding Tunisian Plates

Tunisian number plates are unique in their format, reading from right to left. For instance, the letters “TU” represent “تونس”, and “RS” stands for “ت ن”. A sample registration number like “818TU223” could also be interpreted as:

223تونس818

Data Returned by the API

Upon querying a Tunisian license plate, the API will return a wealth of information about the vehicle, including:

  • Make / Model: Identifies the brand and model of the car.
  • Year: The year of registration.
  • Fuel Type: Details the type of fuel the vehicle uses.
  • Variant: Specifies the variant of the model.
  • Engine Type: Provides information about the engine.
  • Representative Image: A URL to an image of the vehicle.

Sample JSON Response

For a better understanding, here’s a sample JSON response for the registration number “818TU223”:

{
  "Description": "Kia PICANTO",
  "RegistrationYear": "2017",
  "RegistrationDate": "01-01-2017",
  "CarMake": {
    "CurrentTextValue": "Kia"
  },
  "CarModel": {
    "CurrentTextValue": "PICANTO"
  },
  "MakeDescription": {
    "CurrentTextValue": "Kia"
  },
  "ModelDescription": {
    "CurrentTextValue": "PICANTO"
  },
  "FuelType": "Essence",
  "Variant": "III (JA) ( 03-2017 > )",
  "Engine": "1.0 67ch ( 03-2017 > ---- ) ",
  "Type": "VOITURE PARTICULIERE",
  "FiscalPower": "0",
  "ImageUrl": "http://www.vehiculeapi.tn/image.aspx/@S2lhIFBJQ0FOVE8="
}

This new feature is a significant step forward in our commitment to providing comprehensive and user-friendly vehicle information services worldwide. It opens up a new avenue for users in Tunisia to easily access detailed vehicle information with just a license plate number.

Stay tuned for more updates and enhancements to our License Plate Lookup API!

Categories: Uncategorized

Using the PayPal REST #API in C#

Some of this code requires custom-built libraries, so it’s not a great reference, but conceptually, you should be able to see how to use the PayPal REST API in C# using this technique

First, Authentication, you need to get a bearer token before you can all any interesting API endpoints;

        private static string Authenticate(Environment environment)
        {
            var credential = Sandbox;
            if (environment == Environment.LIVE) credential = Live;
            var auth = Convert.ToBase64String(Encoding.UTF8.GetBytes(
                credential.UserName + ":" + credential.Password));
            var http = new HTTPRequest 
            {
                HeaderHandler = h => new NameValueCollection
                {
                    { "Authorization", "Basic " + auth }
                }
            };
            var apiAuthEndpoint = "https://api-m.sandbox.paypal.com/v1/oauth2/token";
            if (environment == Environment.LIVE)
            {
                apiAuthEndpoint = "https://api-m.paypal.com/v1/oauth2/token";
            }
            const string strGrant = "grant_type=client_credentials";
            var authResponse = http.Request(apiAuthEndpoint, "POST", strGrant);
            var jAuthResponse = JObject.Parse(authResponse);
            var token = jAuthResponse["access_token"] + "";
            return token;
        }

Once you have a token, then you can create an order, which in effect gives you a URL to send the user to, and an ID that you should keep for future reference;

            var token = Authenticate(environment);
         
            var intPackageAmount = 100;
            var packageCurrency = "USD";

            var intent = new
            {
                intent = "CAPTURE",
                purchase_units = new[]
                {
                    new
                    {
                        amount = new
                        {
                            currency_code = packageCurrency,
                            value = intPackageAmount
                        }
                    }
                },
                payment_source = new
                {
                    paypal = new
                    {
                        experience_context = new
                        {
                            payment_method_preference = "UNRESTRICTED",
                            landing_page = "LOGIN",
                            user_action = "PAY_NOW",
                            return_url = domain + "/payments/paypalOrderComplete.aspx",
                            cancel_url = domain
                        }
                    }
                }
            };

            var json = JsonConvert.SerializeObject(intent, Formatting.Indented);
            var apiEndpoint = "https://api-m.sandbox.paypal.com/v2/checkout/orders";
            if (environment == Environment.LIVE)
            {
                apiEndpoint = "https://api-m.paypal.com/v2/checkout/orders";
            }
            var http = new HTTPRequest
            {
                HeaderHandler = h => new NameValueCollection
                {
                    { "Authorization", "Bearer " + token }
                },
                ContentType = "application/json"
            };
            var orderSetupJson = http.Request(apiEndpoint, "POST", json);
            var jOrderSetup = JObject.Parse(orderSetupJson);
            var paypalId = jOrderSetup["id"] + "";
            var linksArray = jOrderSetup["links"] as JArray;
            if (linksArray == null) throw new Exception("Paypal Order setup failed");
            var url = "";
            foreach (var link in linksArray)
            {
                if (link["rel"] + "" != "payer-action") continue;
                url = link["href"] + "";
                break;
            }

The Option that said “unrestricted”, helped later on with the capture part.

Once you’ve sent the user to the URL provided by paypal, and it’s returned to your return url, it should also provide you with a token in the Querystring, which matches the id of the order. – I’ve omitted the bit where this is held in a database while the user makes the payment.

Once it comes back, you need to capture the payment as follows;

   // Capture payment
   var apiCaptureEndpoint = "https://api-m.paypal.com/v2/checkout/orders/{0}/capture";
   if (environment == Environment.LIVE)
   {
       apiCaptureEndpoint = "https://api-m.paypal.com/v2/checkout/orders/{0}/capture";
   }
   apiCaptureEndpoint = string.Format(apiCaptureEndpoint, paypalOrderId);
   var captureResponse = http.Request(apiCaptureEndpoint, "POST", "");
   var jCaptureResponse = JObject.Parse(captureResponse);
   status = jCaptureResponse["status"] + "";

Status should be “COMPLETED” after this process is completed, and the money should be transferred.

Test first on sandbox before going live.

Categories: Uncategorized

Transfer #IIS bindings from one server to another using #Powershell

Ok, it’s a common task, you’re migrating from one server to another, but you have one website that responds to 100’s of bindings, and you have to move them. Of course you can copy and paste one by one, but here’s a script to do so. It also works with IDN domains.

First, on the source server, run this;

Import-Module WebAdministration

$siteName = "YOUR_SITE.COM"
$exportPath = "C:\TEMP\bindings.csv"

$bindings = Get-WebBinding -Name $siteName | 
            Where-Object { $_.protocol -eq 'http' } | 
            Select-Object protocol, bindingInformation

$bindings | Export-Csv -Path $exportPath -NoTypeInformation -Encoding UTF8

Then, copy the file bindings.csv to the new server, and import them using this

Import-Module WebAdministration

$siteName = "YOUR_SITE.com"
$importPath = "C:\temp\bindings.csv"

$bindings = Import-Csv -Path $importPath -Encoding UTF8

foreach ($binding in $bindings) {
    $protocol = $binding.protocol
    $bindingInformation = $binding.bindingInformation -split ':'
    $ipAddress = $bindingInformation[0]
    $port = $bindingInformation[1]
    $hostHeader = $bindingInformation[2]

    New-WebBinding -Name $siteName -Protocol $protocol -IPAddress $ipAddress -Port $port -HostHeader $hostHeader
}

This doesn’t work for HTTPS domains, since you need to copy the public/private keys as well, and it’s more complex.

Categories: Uncategorized

Optimizing #MySQL performance on Windows

The MySQL community edition, when installed using default settings is limited to 128MB of memory, which makes it unobtrusive, and won’t hog resources if misused, which is fine. But sometimes you need a blast of performance, to help run queries fast, even if it gets greedy with memory.

Everybody knows that memory is faster than disk, so if you find that MySQL is using 100% (or maxing out), disk usage, and only using 128MB of memory, then you will benefit from giving MySQL more access to available memory. Lets say your desktop machine is 16GB, you can easily give it 10GB (10G) of memory without affecting system stability. Ypu can see all of this in task manager.

So, assuming you’re using Windows, you need to open notepad (or another text editor) as Adminsistrator and then open the file C:\ProgramData\MySQL\MySQL Server 8.0\my.ini

Find the part that says

innodb_buffer_pool_size=….

and change it to

innodb_buffer_pool_size=10G

Then stop and start the MySQL service (Using Services.msc).

As you start running heavy queries, you should see the memory usage of MySQLd go up, and the disk usage go down.

Categories: Uncategorized

gnutls_handshake() failed: Handshake failed – #GIT #error #Ubuntu #BitBucket

When trying to connect via GIT to BitBucket from an older server, I got this error;
fatal: unable to access xxx : gnutls_handshake() failed: Handshake failed

After updating GIT, CA root certifiates, rebooting the server, nothing seemed to work.

Then I did;

Get the SSH public key as follows;

cat /home/ubuntu/.ssh/id_rsa.pub

Then log into bitbucket, and press the settings cog in the top right, then “Personal Bitbucket settings”, then SSH Keys, 

then paste in the public key from the result above. 

Once added, you can do;

git clone git@bitbucket.org:XXX/XXX

Hope this helps someone!

Categories: Uncategorized